fix: use got_initial_pkt instead of new_conn for send_reset decision
new_conn is only true for the first INIT after server restart. Subsequent INITs from same peer (recovery loop) see new_conn=0 and revert to old logic, sending 0x05 (no reset) and overwriting the first 0x03 response. got_initial_pkt stays 0 until client actually sends seq=1, so server keeps sending 0x03 across all INIT retries until client resets and starts from seq=1.
This commit is contained in:
1 parent
661781dc99
commit
f2b396cb48
1 file changed
+5
-5
@@ -1727,9 +1727,9 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
|
||||
// For CHANNEL_INIT (0x04): if link already initialized - no reset, otherwise reset
|
||||
// For INIT_REQUEST (0x02): always reset
|
||||
// Check session_id: if same - no reinit, if different - client restarted, do reinit
|
||||
if (code == ETCP_INIT_REQUEST || conn->session_id != session_id || new_conn) {
|
||||
send_reset = 1; // Client explicitly requested reset, or new session, or new server-side connection
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_CONNECTION, "do reinit (code=%02x session was %08x now %08x new_conn=%d)", code, conn->session_id, session_id, new_conn);
|
||||
if (code == ETCP_INIT_REQUEST || conn->session_id != session_id || !conn->got_initial_pkt) {
|
||||
send_reset = 1; // Client explicitly requested reset, or new session, or server waiting for first packet
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_CONNECTION, "do reinit (code=%02x session was %08x now %08x got_init=%d)", code, conn->session_id, session_id, conn->got_initial_pkt);
|
||||
conn->session_id = session_id;
|
||||
etcp_conn_reinit(conn);
|
||||
} else {
|
||||
@@ -1753,9 +1753,9 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
|
||||
link->remote_type = req->type;
|
||||
|
||||
// For new links: reset if client requested or session changed
|
||||
if (code == ETCP_INIT_REQUEST || conn->session_id != session_id || new_conn) {
|
||||
if (code == ETCP_INIT_REQUEST || conn->session_id != session_id || !conn->got_initial_pkt) {
|
||||
send_reset = 1;
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_CONNECTION, "do reinit for new link (code=%02x session was %08x now %08x new_conn=%d)", code, conn->session_id, session_id, new_conn);
|
||||
DEBUG_TRACE(DEBUG_CATEGORY_CONNECTION, "do reinit for new link (code=%02x session was %08x now %08x got_init=%d)", code, conn->session_id, session_id, conn->got_initial_pkt);
|
||||
conn->session_id = session_id;
|
||||
etcp_conn_reinit(conn);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user