[En-Nut-Discussion] Thread stops executing after some time.
Henrik Maier
hmlists at focus-sw.com
Mon Mar 31 04:17:25 CEST 2008
It would be interesting to know in what TCP state (sock->state) your dead
connections are. Maybe you could log that in some debug thread. Refer to the
httpserv.c example's ShowSockets function how the log the TCP states. Also
interesting would be the sock->so_last_error variable.
> Can it be that for some reason the code below never returns:
> if(NutTcpConnect(socket, rip, TCPSERVERPORT) == 0)
Unlikely but it could, and I try to explain why:
NutTcpConnect calls internally NutTcpStateActiveOpenEvent. This function
actually blocks without time-out on NutEventWait. The event it waits for is
raised by the TCP state machine. If for some reason this event never occurs,
NutTcpConnect will never return.
Maybe you came across a case that the TCP state machine does not trigger the
event NutTcpStateActiveOpenEvent is waiting for. For example some race
condition or a misbehaving server? This needs further investigation and
finding out the TCP state of the "dead" socket is a good starting point.
Henrik
http://www.proconx.com
More information about the En-Nut-Discussion
mailing list