Skip to content

Commit 079e8e4

Browse files
tcp: added some debugging prints, remove later
1 parent 43d4344 commit 079e8e4

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

src/net/tcp/connection.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ bool Connection::handle_ack(const Packet_view& in)
405405

406406
if(is_win_update(in, true_win))
407407
{
408+
if(cb.SND.WND < SMSS()*2)
409+
printf("Win update: %u => %u\n", cb.SND.WND, true_win);
408410
cb.SND.WND = true_win;
409411
cb.SND.WL1 = in.seq();
410412
cb.SND.WL2 = in.ack();
@@ -584,7 +586,7 @@ void Connection::on_dup_ack(const Packet_view& in)
584586
// 3 dup acks
585587
else if(dup_acks_ == 3)
586588
{
587-
debug("<TCP::Connection::on_dup_ack> Dup ACK == 3 - UNA=%u recover=%u\n", cb.SND.UNA, cb.recover);
589+
printf("<TCP::Connection::on_dup_ack> Dup ACK == 3 - UNA=%u recover=%u\n", cb.SND.UNA, cb.recover);
588590

589591
if(cb.SND.UNA - 1 > cb.recover)
590592
goto fast_rtx;
@@ -968,8 +970,8 @@ void Connection::retransmit() {
968970

969971
// TODO: Finish to send window zero probe, but only on rtx timeout
970972

971-
debug2("<Connection::retransmit> With data (wq.sz=%u) buf.unacked=%u\n",
972-
writeq.size(), buf->size(), buf->size() - writeq.acked());
973+
printf("<Connection::retransmit> With data (wq.sz=%zu) buf.size=%zu buf.unacked=%zu SND.WND=%u CWND=%u\n",
974+
writeq.size(), buf->size(), buf->size() - writeq.acked(), cb.SND.WND, cb.cwnd);
973975
fill_packet(*packet, buf->data() + writeq.acked(), buf->size() - writeq.acked());
974976
packet->set_flag(PSH);
975977
}
@@ -1041,8 +1043,8 @@ void Connection::rtx_clear() {
10411043
begins (i.e., after the three-way handshake completes).
10421044
*/
10431045
void Connection::rtx_timeout() {
1044-
debug("<Connection::RTX@timeout> Timed out (RTO %lld ms). FS: %u\n",
1045-
rttm.rto_ms().count(), flight_size());
1046+
printf("<Connection::RTX@timeout> Timed out (RTO %lld ms). FS: %u usable=%u\n",
1047+
rttm.rto_ms().count(), flight_size(), usable_window());
10461048

10471049
signal_rtx_timeout();
10481050
// experimental
@@ -1383,12 +1385,12 @@ void Connection::reduce_ssthresh() {
13831385
fs = (fs >= two_seg) ? fs - two_seg : 0;
13841386

13851387
cb.ssthresh = std::max( (fs / 2), two_seg );
1386-
debug2("<TCP::Connection::reduce_ssthresh> Slow start threshold reduced: %u\n",
1388+
printf("<TCP::Connection::reduce_ssthresh> Slow start threshold reduced: %u\n",
13871389
cb.ssthresh);
13881390
}
13891391

13901392
void Connection::fast_retransmit() {
1391-
debug("<TCP::Connection::fast_retransmit> Fast retransmit initiated.\n");
1393+
printf("<TCP::Connection::fast_retransmit> Fast retransmit initiated.\n");
13921394
// reduce sshtresh
13931395
reduce_ssthresh();
13941396
// retransmit segment starting SND.UNA
@@ -1403,5 +1405,5 @@ void Connection::finish_fast_recovery() {
14031405
fast_recovery_ = false;
14041406
//cb.cwnd = std::min(cb.ssthresh, std::max(flight_size(), (uint32_t)SMSS()) + SMSS());
14051407
cb.cwnd = cb.ssthresh;
1406-
debug("<TCP::Connection::finish_fast_recovery> Finished Fast Recovery - Cwnd: %u\n", cb.cwnd);
1408+
printf("<TCP::Connection::finish_fast_recovery> Finished Fast Recovery - Cwnd: %u\n", cb.cwnd);
14071409
}

0 commit comments

Comments
 (0)