The network_socket_close() API returns immediately with -EAGAIN if the network stack is currently resetting. This means that one needs to call the API in a loop to ensure that sockets are properly closed after a reset. See example. We shouldn't ask users to write such an ugly loop.
@davidchisnall suggests to have the loop inside of the network_socket_close() API.
There have also been discussions in the past (among others with @nwf) about finding a good way to have all threads exit the compartment in the case of a reset. This is related to this issue. I didn't give up on this and Wes had concrete ideas for the switcher. Unfortunately, this would make it hard to have this loop inside of the TCP/IP compartment.
The loop could, however, be implemented as a simple wrapper.
One could perhaps also picture exposing a futex that tells when the reboot is done to avoid the dirty loop altogether.
The
network_socket_close()API returns immediately with-EAGAINif the network stack is currently resetting. This means that one needs to call the API in a loop to ensure that sockets are properly closed after a reset. See example. We shouldn't ask users to write such an ugly loop.@davidchisnall suggests to have the loop inside of the
network_socket_close()API.There have also been discussions in the past (among others with @nwf) about finding a good way to have all threads exit the compartment in the case of a reset. This is related to this issue. I didn't give up on this and Wes had concrete ideas for the switcher. Unfortunately, this would make it hard to have this loop inside of the TCP/IP compartment.
The loop could, however, be implemented as a simple wrapper.
One could perhaps also picture exposing a futex that tells when the reboot is done to avoid the dirty loop altogether.