@@ -53,8 +53,9 @@ Connection::Connection(TCP& host, Socket local, Socket remote, ConnectCallback c
5353
5454Connection::~Connection ()
5555{
56- // printf("<Connection> Deleted %p %s ACTIVE: %u \n", this,
56+ // printf("<Connection> Deleted %p %s ACTIVE: %zu \n", this,
5757 // to_string().c_str(), host_.active_connections());
58+
5859 rtx_clear ();
5960}
6061
@@ -434,6 +435,8 @@ bool Connection::handle_ack(const Packet_view& in)
434435
435436 if (is_win_update (in, true_win))
436437 {
438+ // if(cb.SND.WND < SMSS()*2)
439+ // printf("Win update: %u => %u\n", cb.SND.WND, true_win);
437440 cb.SND .WND = true_win;
438441 cb.SND .WL1 = in.seq ();
439442 cb.SND .WL2 = in.ack ();
@@ -613,7 +616,7 @@ void Connection::on_dup_ack(const Packet_view& in)
613616 // 3 dup acks
614617 else if (dup_acks_ == 3 )
615618 {
616- debug (" <TCP::Connection::on_dup_ack> Dup ACK == 3 - UNA=%u recover=%u\n " , cb.SND .UNA , cb.recover );
619+ // printf ("<TCP::Connection::on_dup_ack> Dup ACK == 3 - UNA=%u recover=%u\n", cb.SND.UNA, cb.recover);
617620
618621 if (cb.SND .UNA - 1 > cb.recover )
619622 goto fast_rtx;
@@ -997,8 +1000,8 @@ void Connection::retransmit() {
9971000
9981001 // TODO: Finish to send window zero probe, but only on rtx timeout
9991002
1000- debug2 (" <Connection::retransmit> With data (wq.sz=%u ) buf.unacked=%u\n " ,
1001- writeq.size (), buf->size (), buf->size () - writeq.acked ());
1003+ // printf ("<Connection::retransmit> With data (wq.sz=%zu ) buf.size=%zu buf. unacked=%zu SND.WND=%u CWND =%u\n",
1004+ // writeq.size(), buf->size(), buf->size() - writeq.acked(), cb.SND.WND, cb.cwnd );
10021005 fill_packet (*packet, buf->data () + writeq.acked (), buf->size () - writeq.acked ());
10031006 packet->set_flag (PSH);
10041007 }
@@ -1070,8 +1073,8 @@ void Connection::rtx_clear() {
10701073 begins (i.e., after the three-way handshake completes).
10711074*/
10721075void Connection::rtx_timeout () {
1073- debug (" <Connection::RTX@timeout> Timed out (RTO %lld ms). FS: %u\n " ,
1074- rttm.rto_ms ().count (), flight_size ());
1076+ // printf ("<Connection::RTX@timeout> Timed out (RTO %lld ms). FS: %u usable= %u\n",
1077+ // rttm.rto_ms().count(), flight_size(), usable_window ());
10751078
10761079 signal_rtx_timeout ();
10771080 // experimental
@@ -1421,12 +1424,12 @@ void Connection::reduce_ssthresh() {
14211424 fs = (fs >= two_seg) ? fs - two_seg : 0 ;
14221425
14231426 cb.ssthresh = std::max ( (fs / 2 ), two_seg );
1424- debug2 (" <TCP::Connection::reduce_ssthresh> Slow start threshold reduced: %u\n " ,
1425- cb.ssthresh );
1427+ // printf ("<TCP::Connection::reduce_ssthresh> Slow start threshold reduced: %u\n",
1428+ // cb.ssthresh);
14261429}
14271430
14281431void Connection::fast_retransmit () {
1429- debug (" <TCP::Connection::fast_retransmit> Fast retransmit initiated.\n " );
1432+ // printf ("<TCP::Connection::fast_retransmit> Fast retransmit initiated.\n");
14301433 // reduce sshtresh
14311434 reduce_ssthresh ();
14321435 // retransmit segment starting SND.UNA
@@ -1441,5 +1444,5 @@ void Connection::finish_fast_recovery() {
14411444 fast_recovery_ = false ;
14421445 // cb.cwnd = std::min(cb.ssthresh, std::max(flight_size(), (uint32_t)SMSS()) + SMSS());
14431446 cb.cwnd = cb.ssthresh ;
1444- debug (" <TCP::Connection::finish_fast_recovery> Finished Fast Recovery - Cwnd: %u\n " , cb.cwnd );
1447+ // printf ("<TCP::Connection::finish_fast_recovery> Finished Fast Recovery - Cwnd: %u\n", cb.cwnd);
14451448}
0 commit comments