1
0
forked from aniani/gmnisrv

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; ) { for (int w = 0; w < r; ) {
int q = write(client->sockfd, &buf[w], r - w); int q = write(client->sockfd, &buf[w], r - w);
if (q < 0) { 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; w += q;
} }