fix: conn_reset only on got_initial_pkt==0 or sess_changed
- etcp_link_enter_init: new link on live conn sends NOINIT, not full reset - etcp_link_enter_reinit: don't conn_reinit on single link recovery, preserve inflight - handle_nl_link: fall through to remove_iface_sockets when if_indextoname fails - duplicate INIT: add INFO log for diagnostic Test: sequence checking (gaps=0 dups=0), exact socket/link counts, stale link detection, conn health checks, full disconnect+reconnect phase
This commit is contained in:
1 parent
8583d4216f
commit
a73cc1beea
3 files changed
+184
-39
No files matched your search
@@ -933,7 +933,7 @@ static void handle_nl_addr(struct AUTO_SOCKET* as, struct ifaddrmsg* ifa, int ms
|
||||
static void handle_nl_link(struct AUTO_SOCKET* as, struct ifinfomsg* ifi, int msg_type) {
|
||||
char ifname[IFNAMSIZ];
|
||||
if (!if_indextoname(ifi->ifi_index, ifname)) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_AS, "[as] handle_nl_link: if_indextoname(%u) failed, msg=%d — removing by index",
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_AS, "[as] handle_nl_link: if_indextoname(%u) failed, msg=%d — removing by index",
|
||||
ifi->ifi_index, msg_type);
|
||||
remove_iface_sockets(as, ifi->ifi_index);
|
||||
return;
|
||||
|
||||
@@ -293,7 +293,8 @@ void etcp_link_enter_init(struct ETCP_LINK* link) {//
|
||||
link->link_state = LINK_STATE_HANDSHAKE; // handshake
|
||||
etcp_fire_link_status_cbk(link, old_state, link->link_status);
|
||||
if (link->is_server != 0) return;
|
||||
etcp_link_send_init(link,1,0);// init with reset
|
||||
int reset = (link->etcp->got_initial_pkt == 0);
|
||||
etcp_link_send_init(link, reset, 0);
|
||||
etcp_link_restart_init_timer(link);
|
||||
}
|
||||
|
||||
@@ -305,8 +306,8 @@ void etcp_link_enter_reinit(struct ETCP_LINK* link) {
|
||||
etcp_fire_link_status_cbk(link, old_state, link->link_status);
|
||||
etcp_on_link_down(link->etcp, link);
|
||||
if (link->is_server != 0) return;
|
||||
etcp_conn_reinit(link->etcp, "link recovery");
|
||||
etcp_link_send_init(link,1,0);
|
||||
int reset = (link->etcp->got_initial_pkt == 0);
|
||||
etcp_link_send_init(link, reset, 0);
|
||||
|
||||
if (link->keepalive_timer) {// keepalive заменяяется reinit запросами
|
||||
uasync_cancel_timeout(link->etcp->instance->ua, link->keepalive_timer);
|
||||
@@ -2285,7 +2286,11 @@ void etcp_connections_read_callback_socket(socket_t sock, void* arg) {
|
||||
{ int sess_changed = (conn->session_id != session_id);
|
||||
conn->session_id = session_id;
|
||||
if (req->code == ETCP_INIT_REQUEST) {
|
||||
if (sess_changed || conn->got_initial_pkt) etcp_conn_reinit(conn, "duplicate INIT");
|
||||
if (sess_changed || conn->got_initial_pkt) {
|
||||
DEBUG_INFO(DEBUG_CATEGORY_ETCP, "[%s] INIT_REQUEST on existing link: code=0x%02x sess_ch=%d got_init=%d → reinit",
|
||||
conn->log_name, req->code, sess_changed, conn->got_initial_pkt);
|
||||
etcp_conn_reinit(conn, "duplicate INIT");
|
||||
}
|
||||
send_reset = 0;
|
||||
} else {
|
||||
if (conn->got_initial_pkt == 0) send_reset = 1;
|
||||
|
||||
Reference in new issue
Block a user