@@ -485,10 +485,10 @@ class Connection : public std::enable_shared_from_this<Connection> {
485485 Timer timewait_timer;
486486
487487 /* * Number of retransmission attempts on the packet first in RT-queue */
488- size_t rtx_attempt_ = 0 ;
488+ int8_t rtx_attempt_ = 0 ;
489489
490490 /* * number of retransmitted SYN packets. */
491- size_t syn_rtx_ = 0 ;
491+ int8_t syn_rtx_ = 0 ;
492492
493493 /* * Congestion control */
494494 // is fast recovery state
@@ -665,19 +665,19 @@ class Connection : public std::enable_shared_from_this<Connection> {
665665 Invoke/signal the diffrent TCP events.
666666 */
667667 void signal_connect ()
668- { on_connect_ (shared_from_this ()); }
668+ { if (on_connect_) on_connect_ (shared_from_this ()); }
669669
670670 void signal_disconnect (Disconnect::Reason&& reason)
671671 { on_disconnect_ (shared_from_this (), Disconnect{reason}); }
672672
673673 void signal_error (TCPException error)
674- { on_error_ (std::forward<TCPException>(error)); }
674+ { if (on_error_) on_error_ (std::forward<TCPException>(error)); }
675675
676676 void signal_packet_dropped (const Packet& packet, const std::string& reason)
677- { on_packet_dropped_ (packet, reason); }
677+ { if (on_packet_dropped_) on_packet_dropped_ (packet, reason); }
678678
679679 void signal_rtx_timeout ()
680- { on_rtx_timeout_ (rtx_attempt_+1 , rttm.RTO ); }
680+ { if (on_rtx_timeout_) on_rtx_timeout_ (rtx_attempt_+1 , rttm.RTO ); }
681681
682682 /*
683683 Drop a packet. Used for debug/callback.
0 commit comments