diff --git a/src/etcp_connections.c b/src/etcp_connections.c index b03fb0c..ea38a65 100644 --- a/src/etcp_connections.c +++ b/src/etcp_connections.c @@ -572,7 +572,9 @@ static void etcp_connections_read_callback_socket(socket_t sock, void* arg) { struct ETCP_LINK* link=etcp_link_find_by_addr(e_sock, &addr); // printf("[ETCP DEBUG] Received packet, link=%p, recv_len=%zd\n", link, recv_len); - if (link==NULL) {// пробуем расшифровать, возможно это init + // If no link found OR found link is a client link (not server), treat as potential INIT + // Client links shouldn't receive incoming INIT packets - only server links should + if (link==NULL || link->is_server==0) {// пробуем расшифровать, возможно это init // printf("[ETCP DEBUG] No existing link found, trying to decrypt as INIT packet\n"); struct secure_channel sc; if (recv_len<=SC_PUBKEY_SIZE) { errorcode=1; DEBUG_ERROR(DEBUG_CATEGORY_ETCP, "etcp_connections_read_callback: packet too small for init, size=%zd", recv_len); goto ec_fr; }