diff options
| author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-30 11:32:33 +0100 |
|---|---|---|
| committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2024-10-30 11:45:40 +0100 |
| commit | 4fcb5f2e5d49bbf712945669b1de480d46595767 (patch) | |
| tree | 8750edc976546c39528105b6488ace8fb5de3803 /chatty.c | |
| parent | 2ab4648096c23d274c8f74997e271ca5cdcc6cac (diff) | |
Refactor server code into functions
- disconnect(): for disconnecting a client and deinitializing it
- sendToOthers(): for sending a message to all other clients
- initClient(): for initializing a client
Diffstat (limited to 'chatty.c')
| -rw-r--r-- | chatty.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -44,10 +44,11 @@ popup(u32 fg, u32 bg, char* text) tb_print(global.width / 2 - len / 2, global.height / 2, fg, bg, text); } -// Takes as paramter `struct sockaddr_in*` and uses it to connect to the server. -// When the server sends a disconnect message this function must be called with the fds struct as -// paramter. To indicate that the server is offline the fds[FDS_SERVER] is set to -1. When online -// it is set to a non-zero value. +// Connect to *address_ptr of type `struct sockaddr_in*`. If it failed wait for TIMEOUT_RECONNECT +// seconds. +// This function is meant to be run by a thread. +// An offline server means fds[FDS_SERVER] is set to -1. When online +// it is set to with the appropriate file descriptor. // Returns NULL. void* thread_reconnect(void* address_ptr) |
