[En-Nut-Discussion] NutTcpAccept() time-out proposal

Henrik Maier hmlists at focus-sw.com
Tue Mar 28 03:48:48 CEST 2006


NutTcpAccept() does currently not honour any socket time-outs. It might 
be useful for applications to perform some error management in case no 
server connects within a given time.

I propose to change tcpsm.c so NutTcpAccept honours the read time-out.
In NutTcpStatePassiveOpenEvent change:

     NutEventWait(&sock->so_pc_tq, 0);
     return 0;

to:
     return NutEventWait(&sock->so_pc_tq, sock->so_read_to);

At the  same time I also found another blocking NutEventWait call in the 
function NutTcpStateActiveOpenEvent where the tcpsm can block infinitely 
if we never receive a SYNACK and a time-out might be useful here too.

In NutTcpStateActiveOpenEvent change:

	 if(sock->so_state == TCPS_SYN_SENT)
		NutEventWait(&sock->so_ac_tq, 0);

to:
	 if(sock->so_state == TCPS_SYN_SENT)
		NutEventWait(&sock->so_ac_tq, sock->so_read_to);



Henrik
http://www.proconx.com



More information about the En-Nut-Discussion mailing list