|
From: | Albert Bartel |
Subject: | Re: [lwip-devel] communication hangs after single ACK |
Date: | Thu, 19 Nov 2009 17:30:47 +0100 |
Finally we found the bug
that was responsible for the communication hang for 60sec after a single ack. It could be easy reproduced with
fast and short requests, much more often with vista than with xp (because tcp/ip
with vista is faster than with xp). The request was received,
correctly processed and a NETCONN_EVT_RCVPLUS should be sent by calling API_EVENT()
but because of speed problems the conn->socket (that is prior
also stored in the local variable s) is invalid after the first try. After the sys_sem_wait(socksem) it is checked again. If it is still
invalid, there is a return. But
if we now got a valid conn->socket we get
the socket with sock = get_socket(s), but s is still invalid. Because
s is used later, s should be set to conn->socket after we get a valid conn->socket. (see comment) static void event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) { int s; struct lwip_socket *sock; struct lwip_select_cb *scb; LWIP_UNUSED_ARG(len); if (conn) { s = conn->socket; if (s < 0) { sys_sem_wait(socksem); if (conn->socket < 0) { if (evt == NETCONN_EVT_RCVPLUS) { conn->socket--; }
sys_sem_signal(socksem); return; } // set s to conn->socket because
now conn->socket is valid // and s (old conn->socket) is still
invalid s = conn->socket; sys_sem_signal(socksem); } sock = get_socket(s); if (!sock) { return; } } else { return; } ... } |
[Prev in Thread] | Current Thread | [Next in Thread] |