diff options
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -61,6 +61,9 @@ int main() { if (n <= 0) { /* close the connection if client disappeared or disconnected */ close(fds[i].fd); + fds[i] = fds[nfds - 1]; /* move back last slot */ + nfds--; /* size down the current aray */ + i--; } else { /* send every n bytes to the other clients */ for (nfds_t j = 1; j < nfds; j++) { |
