lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] issues with resending out of order segments


From: Kieran Mansley
Subject: RE: [lwip-users] issues with resending out of order segments
Date: Mon, 21 Sep 2009 11:06:32 +0100

On Mon, 2009-09-21 at 11:41 +0200, Kesten, Joerg wrote:
> This is something which is very likely to happen in my application.
> 
> I am using the sockets API in a multithreaded environment, and in fact
> already ran into several issues with synchronization.
> I already added additional locks so that only one thread is allowed to
> call "send", and mutex'ed sending and receiving in one connection.

Multithreaded sockets is something that is not well supported on lwIP,
so I'm not surprised you've had to add some extra locks.  If you're
making sure that only one thread can use each socket then this is
something I would like to work, so if it doesn't we should look at why
and work out how to fix it.

> But I'd assumed that receiving data at such a low level is something
> which can occur anytime when sending, even in a single threaded
> application?

It can, but the stack needs to be protected from this, so there is a
special thread (tcpip_thread) which is passed all the received packets
from the driver, and all the data to send, and it should serialise the
sending and receiving.  If we're seeing corruption it suggests that it's
not being correctly serialised.

> In the driver there is a special thread which pends on incoming data
> and calls ethernetif_input

How do you call netif_add()?  This function specifies which function
will be called (stored in netif->input) when a packet is received by
ethernetif_input().

> Is there any "natural" place were I could/should lock access to the unsent 
> list?

No, if you're using the APIs correctly you shouldn't need to manually
lock these lists. 

Kieran





reply via email to

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