Skip to content

tcp_listen: Missing register_poll_fd

Bug fix: tcp_listen() needs to invoke the socket's register_poll_fd() callback so that platforms can add the socket to their collection of sockets-of-interest (primarily Windows, also platforms that use select() and not poll()).

For Windows, host forwarding "now works gooder!"

The socket is eventually unregistered via the two use cases in which tcp_listen() is used:

  • slirp_add_hostfwd, slirp_add_hostxfwd: The corresponding "remove" functions (slirp_remove_hostfwd, slirp_remove_hostxfwd) invoke unregister_poll_fd().

  • TCP emulation (tcp_emu() in tcp_subr.c): All calls to tcp_listen() set the SS_FACCEPTONCE flag, making the accept() a one-shot event. By carefully examining tcp_subr.c, lines 523-531, one sees that tcp_connect() unregisters the one-shot accept().

QED.

Merge request reports

Loading