1
0
mirror of https://github.com/elua/elua.git synced 2025-01-25 01:02:54 +08:00

tentative fix for net.close

This commit is contained in:
Bogdan Marinescu 2010-02-23 11:12:13 +00:00
parent 15daebf98e
commit 11b2e6927f

View File

@ -512,8 +512,9 @@ static void elua_prep_socket_state( volatile struct elua_uip_state *pstate, void
int elua_net_socket( int type ) int elua_net_socket( int type )
{ {
int i; int i;
struct uip_conn* pconn; //struct uip_conn* pconn;
volatile struct elua_uip_state *pstate;
// [TODO] add UDP support at some point. // [TODO] add UDP support at some point.
if( type == ELUA_NET_SOCK_DGRAM ) if( type == ELUA_NET_SOCK_DGRAM )
return -1; return -1;
@ -522,8 +523,10 @@ int elua_net_socket( int type )
// Iterate through the list of connections, looking for a free one // Iterate through the list of connections, looking for a free one
for( i = 0; i < UIP_CONNS; i ++ ) for( i = 0; i < UIP_CONNS; i ++ )
{ {
pconn = uip_conns + i; //pconn = uip_conns + i;
if( pconn->tcpstateflags == UIP_CLOSED ) //if( pconn->tcpstateflags == UIP_CLOSED )
pstate = ( volatile struct elua_uip_state* )&( uip_conns[ i ].appstate );
if( pstate->state == ELUA_UIP_STATE_IDLE)
{ {
// Found a free connection, reserve it for later use // Found a free connection, reserve it for later use
uip_conn_reserve( i ); uip_conn_reserve( i );