Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net/tcp: Set SO_ERROR for poll error in setup
Normally, `SO_ERROR` for disconn events will be set by `tcp_poll_eventhandler`, but when the socket is closed before poll, we should also set the `SO_ERROR`. On Linux, `tcp_poll` returns `EPOLLERR` event when `sk->sk_err` has value but doesn't let `poll` fail (doesn't set `errno`). https://github.com/torvalds/linux/blob/v6.5/net/ipv4/tcp.c#L594-L596 Note: `sk->sk_err` can be get by socket option `SO_ERROR` on Linux, so `POLLERR` will always be together with `SO_ERROR`. Common libs like curl may try to read `SO_ERROR` on `POLLERR`. Signed-off-by: Zhe Weng <[email protected]>
- Loading branch information