Split socket creation and connect/listen

This will allow to assign the socket to a variable before connecting or
listening, so that it can be interrupted from another thread.
This commit is contained in:
Romain Vimont
2021-10-31 22:01:57 +01:00
parent ed19901db1
commit 0bfa75a48b
3 changed files with 57 additions and 42 deletions

View File

@@ -31,10 +31,13 @@ void
net_cleanup(void);
sc_socket
net_connect(uint32_t addr, uint16_t port);
net_socket(void);
sc_socket
net_listen(uint32_t addr, uint16_t port, int backlog);
bool
net_connect(sc_socket socket, uint32_t addr, uint16_t port);
bool
net_listen(sc_socket socket, uint32_t addr, uint16_t port, int backlog);
sc_socket
net_accept(sc_socket server_socket);