lwip-devel
[Top][All Lists]
Advanced

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

Re: [lwip-devel] Desiderata for 2.2.0 for debian and virtualsquare (4)


From: Renzo Davoli
Subject: Re: [lwip-devel] Desiderata for 2.2.0 for debian and virtualsquare (4)
Date: Tue, 11 Apr 2023 19:31:26 +0200

The patch #4: socket_accept_avoid_useless_events
has not been merged yet.

The patch here attached just swaps two sections of the code in socket.c, 
function
lwip_accept.
In the current implementation it sends the "anticipated" events
to the callback while it can still fail.
see line 727/728:
 727     err = netconn_peer(newconn, &naddr, &port);
 728     if (err != ERR_OK) {
So events can be generated for sockets that will never exist.
The patch sends the events only when lwip_accept cannot fail any more.

In the normal usage of socket API it is just slighly more efficient
(it simply avoids some useless actions).

I propose this patch because I am developing the code to add a compatibility 
layer 
for lwip to libioth.
https://github.com/virtualsquare/libioth
https://archive.fosdem.org/2021/schedule/event/microkernel_libioth/attachments/slides/4319/export/events/attachments/microkernel_libioth/slides/4319/libioth_slides.pdf

Libioth already supports picotcp and vdestack. Libioth provides a unified 
interface
so that the stack implementation can be chosen at run time just by setting a 
string
parameter of the 'ioth_newstack' function.

Libioth uses vpoll
https://github.com/rd235/libvpoll-eventfd
to support the standard syscalls select/pselect/poll/ppoll/epoll*
to wait for events. 

I overrride the event callback in lwip's socket.c to 'feed' vpoll. Currently
lwip_accept may send events for a socket that will never be created, and there
is not an event to notify the failure...

Without this patch I'd have to reimplement socket.c in the the ioth-lwip module.

Thank you.

        renzo

Attachment: 4.socket_accept_avoid_useless_events.patch
Description: Text Data


reply via email to

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