@@ -676,7 +676,7 @@ class Connection : public std::enable_shared_from_this<Connection> {
676676
677677 /* * Congestion control */
678678 // is fast recovery state
679- bool fast_recovery = false ;
679+ bool fast_recovery_ = false ;
680680 // First partial ack seen
681681 bool reno_fpack_seen = false ;
682682 /* * limited transmit [RFC 3042] active */
@@ -692,6 +692,16 @@ class Connection : public std::enable_shared_from_this<Connection> {
692692 uint8_t dack_{0 };
693693 seq_t last_ack_sent_;
694694
695+ /* * RFC 3522 - The Eifel Detection Algorithm for TCP */
696+ // int16_t spurious_recovery = 0;
697+ // static constexpr int8_t SPUR_TO {1};
698+ // uint32_t rtx_ts_ = 0;
699+ /* * RFC 4015 - The Eifel Response Algorithm for TCP */
700+ // uint32_t pipe_prev = 0;
701+ // static constexpr int8_t LATE_SPUR_TO {1};
702+ // RTTM::seconds SRTT_prev{1.0f};
703+ // RTTM::seconds RTTVAR_prev{1.0f};
704+
695705 // / --- CALLBACKS --- ///
696706
697707 /* *
@@ -868,11 +878,57 @@ class Connection : public std::enable_shared_from_this<Connection> {
868878 */
869879 bool handle_ack (const Packet&);
870880
871- /*
872- When a duplicate ACK is received.
873- */
881+ /* *
882+ * @brief Determines if the incoming segment is a legit window update.
883+ *
884+ * @param[in] in TCP Segment
885+ * @param[in] win The calculated window
886+ *
887+ * @return True if window update, False otherwise.
888+ */
889+ bool is_win_update (const Packet& in, const uint32_t win) const
890+ {
891+ return cb.SND .WND != win and
892+ (cb.SND .WL1 < in.seq () or (cb.SND .WL1 == in.seq () and cb.SND .WL2 <= in.ack ()));
893+ }
894+
895+ /* *
896+ * @brief Determines if duplicate acknowledge, described in [RFC 5681] p.3
897+ *
898+ * @param[in] in TCP segment
899+ *
900+ * @return True if duplicate acknowledge, False otherwise.
901+ */
902+ bool is_dup_ack (const Packet& in, const uint32_t win) const
903+ {
904+ return in.ack () == cb.SND .UNA
905+ and flight_size () > 0
906+ and !in.has_tcp_data ()
907+ and cb.SND .WND == win
908+ and !in.isset (SYN) and !in.isset (FIN);
909+ }
910+
911+ /* *
912+ * @brief Handle duplicate ACK according to New Reno
913+ *
914+ * @param[in] <unnamed> Incoming TCP segment (duplicate ACK)
915+ */
874916 void on_dup_ack (const Packet&);
875917
918+ /* *
919+ * @brief Handle segment according to congestion control (New Reno)
920+ *
921+ * @param[in] <unnamed> Incoming TCP segment
922+ */
923+ void congestion_control (const Packet&);
924+
925+ /* *
926+ * @brief Handle segment according to fast recovery (New Reno)
927+ *
928+ * @param[in] <unnamed> Incoming TCP segment
929+ */
930+ void fast_recovery (const Packet&);
931+
876932 /* *
877933 * @brief Determines ability to send ONE segment, not caring about the usable window.
878934 *
0 commit comments