mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-06 01:40:22 -05:00
Revert "server: use edge-triggered FDM handler for the client connections"
This reverts commit 9141b8a657.
This commit is contained in:
parent
9141b8a657
commit
ed8d7f4bae
1 changed files with 13 additions and 13 deletions
26
server.c
26
server.c
|
|
@ -152,21 +152,21 @@ fdm_client(struct fdm *fdm, int fd, int events, void *data)
|
||||||
return true; /* Let FDM trigger again when we have more data */
|
return true; /* Let FDM trigger again when we have more data */
|
||||||
}
|
}
|
||||||
|
|
||||||
while (client->buffer.left > 0) {
|
/* Keep filling our buffer of initialization data */
|
||||||
/* Keep filling our buffer of initialization data */
|
ssize_t count = recv(
|
||||||
ssize_t count = recv(
|
fd, &client->buffer.data[client->buffer.idx], client->buffer.left, 0);
|
||||||
fd, &client->buffer.data[client->buffer.idx], client->buffer.left, 0);
|
|
||||||
|
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
if (errno == EAGAIN || errno == EWOULDBLOCK)
|
LOG_ERRNO("failed to read");
|
||||||
return true;
|
goto shutdown;
|
||||||
|
}
|
||||||
|
|
||||||
LOG_ERRNO("failed to read");
|
client->buffer.idx += count;
|
||||||
goto shutdown;
|
client->buffer.left -= count;
|
||||||
}
|
|
||||||
|
|
||||||
client->buffer.idx += count;
|
if (client->buffer.left > 0) {
|
||||||
client->buffer.left -= count;
|
/* Not done yet */
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All initialization data received - time to instantiate a terminal! */
|
/* All initialization data received - time to instantiate a terminal! */
|
||||||
|
|
@ -288,7 +288,7 @@ fdm_server(struct fdm *fdm, int fd, int events, void *data)
|
||||||
.fd = client_fd,
|
.fd = client_fd,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!fdm_add(server->fdm, client_fd, EPOLLIN | EPOLLET, &fdm_client, client)) {
|
if (!fdm_add(server->fdm, client_fd, EPOLLIN, &fdm_client, client)) {
|
||||||
close(client_fd);
|
close(client_fd);
|
||||||
free(client);
|
free(client);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue