This commit optimizes the sendmsg UDP pbuf chain creation by not
allocating/freeing a netbuf per io vector and instead building a pbuf
chain directly in the sockets layer
Same as in my last commits - this avoids errors in lwIP code where ip addresses are dereferenced (e.g. for IP type checking) without handling thinking about NULL pointers.
This commit adds support to the sockets and netconn layer to update the
backlog by calling listen when the netconn is already in the listen state.
When backlog is not enabled, the call returns successfully
This commit also introduces a macro for setting the backlog value that
prevents a 0 sized (invalid) backlog
Fix a bug in the socket API's ioctl for FIONREAD. If the socket's
lastdata was assigned the function returned without error but did not
update the argument pointer.
The cast type for argp was also changed to int to conform with the
other SO_RCVBUF handling.
This makes a couple of simple re-arrangements in lwip_selscan() that
should improve performance in the following ways:
1) The old code linearly walked all sockets to maxfd regardless of
whether they were set in the fd set. The process involved
acquiring sys arch protect, looking up the socket, and then
checking if the socket was present in any of the fd sets. On
systems with lots of sockets and a heavy SYS_ARCH_PROTECT
infrastructure (a mutex) this can result in a lot of extra work.
Now we skip this process for any fd that is not in the input sets
2) If the socket from tryget_socket() is NULL we no longer continue
and compare the input fd sets with a zeroed out set of events
3) We no longer need to zero out our event sets because they are
only accessed when tryget_socket() is successful
lwip_selscan() is called at most once per select call and sometimes up to three times
This fixes a bug in close when LWIP_SO_SNDTIMEO is enabled, but
the option is not in use on the socket
A simple mis-typed comparison against zero would cause the close_timeout
to get set to zero if conn->send_timeout was 0
The intended check was to over-ride the default close timeout if a
send timeout had been specified via SO_SNDTIMEO
tcpip_callback_with_block() can fail with ERR_MEM or ERR_VAL, and in the
error paths the code does not post the msg to the mailbox thus the
sys_sem_wait() call might wait forever. Fix it by testing return value of
tcpip_callback() and return error immediately.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
The TCPIP_APIMSG_ACK will call NETCONN_SET_SAFE_ERR for both
LWIP_TCPIP_CORE_LOCKING and !LWIP_TCPIP_CORE_LOCKING cases.
So remove superfluous NETCONN_SET_SAFE_ERR call before TCPIP_APIMSG_ACK.
Signed-off-by: Axel Lin <axel.lin@ingics.com>