1
0
mirror of https://git.sr.ht/~sircmpwn/gmnisrv synced 2024-12-04 14:46:42 -05:00

server: handle write errors

This commit is contained in:
Drew DeVault 2020-10-28 12:36:05 -04:00
parent da6f7e9f05
commit ac6145ed6a

View File

@ -463,7 +463,11 @@ client_writable(struct gmnisrv_server *server, struct gmnisrv_client *client)
for (int w = 0; w < r; ) {
int q = write(client->sockfd, &buf[w], r - w);
if (q < 0) {
assert(0); // TODO: handle write errors
client_error(&client->addr,
"client write: %s",
strerror(errno));
disconnect_client(server, client);
return DISCONNECTED;
}
w += q;
}