aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-01-10 18:49:26 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-01-10 18:49:26 +0000
commited8d7f4bae3c2601e6bb997142f26d30f7b4a1ff (patch)
tree0e3248d2ae07f46886273c365c5361ae6ba0acdd
parentserver: use edge-triggered FDM handler for the client connections (diff)
Revert "server: use edge-triggered FDM handler for the client connections"
This reverts commit 9141b8a6573f973f97aa1615a8cc0c488cfd77e7.
-rw-r--r--server.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/server.c b/server.c
index 71ee113d..92f326a0 100644
--- a/server.c
+++ b/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 */
}
- while (client->buffer.left > 0) {
- /* Keep filling our buffer of initialization data */
- ssize_t count = recv(
- fd, &client->buffer.data[client->buffer.idx], client->buffer.left, 0);
+ /* Keep filling our buffer of initialization data */
+ ssize_t count = recv(
+ fd, &client->buffer.data[client->buffer.idx], client->buffer.left, 0);
- if (count < 0) {
- if (errno == EAGAIN || errno == EWOULDBLOCK)
- return true;
+ if (count < 0) {
+ LOG_ERRNO("failed to read");
+ goto shutdown;
+ }
- LOG_ERRNO("failed to read");
- goto shutdown;
- }
+ client->buffer.idx += count;
+ client->buffer.left -= count;
- client->buffer.idx += count;
- client->buffer.left -= count;
+ if (client->buffer.left > 0) {
+ /* Not done yet */
+ return true;
}
/* 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,
};
- 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);
free(client);
return false;