lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Re opening LWIP for new HTTP message


From: dawilson
Subject: Re: [lwip-users] Re opening LWIP for new HTTP message
Date: Wed, 8 Aug 2012 06:42:48 -0700 (PDT)



H.A. wrote:
> 
> As I tried to mention before, only the serial receive routine has
> currently the knowledge of when a complete serial message is recevied and
> it than uses tcp_write and tcp_output to send out the message.
> 
> Do you mean that I should check if the connection is open in the interrupt
> routine? If open send the message. If not open, open the connection,
> return and let the connect callback send the message? Can the connection
> be closed between the check and the transmit inside the interrupt routine?
> Is this mix of different contexts really safe?
> 
> When I tried to open the connection inside the serial interrupt I did not
> see any SYN packages. Do I have to do an init one more time also?
> 
> 

It sounds to me as if you have some serious context and race condition
issues going on here. The Stellaris port of lwIP 1.3.2 is written such that
you may only call the lwIP raw APIs from within the context of the Ethernet
interrupt handler or, if using SafeRTOS or FreeRTOS, the lwIP thread. If you
call from any other context, you will definitely see problems since the raw
API is not protected against calling from multiple contexts and certainly
not from multiple interrupt contexts.

If you look at the original code for the ser2enet application, you will see
that the serial side writes data into a ring buffer when it is received.
This buffer is then read from a handler function called from
lwIPHostTimerHandler() which is itself called in the right context to allow
you to call the raw API safely. You should ensure that you design your
application similarly such that lwIP calls are only made from within
lwIPHostTimerHandler().



-- 
View this message in context: 
http://old.nabble.com/Reopening-LWIP-for-new-HTTP-message-tp34265577p34271778.html
Sent from the lwip-users mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]