~sircmpwn/gmni-devel

1

[PATCH] Close some files when too many are open

Rémy Noulin <loader2x@gmail.com>
Details
Message ID
<CACoVjN0sjQUcB=ZK=TtakM05dEVxDeOpiTbOBqshG6RkiyLq9g@mail.gmail.com>
DKIM signature
pass
Download raw message
src/server.c | 6 ++++++
1 file changed, 6 insertions(+)
---
 src/server.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/server.c b/src/server.c
index 56e11c9..7c56974 100644
--- a/src/server.c
+++ b/src/server.c
@@ -115,6 +115,12 @@ accept_client(struct gmnisrv_server *server, int fd)
        int sockfd = accept(fd, &addr, &addrlen);
        if (sockfd == -1) {
                server_error("accept error: %s", strerror(errno));
+               if (errno == EMFILE) {
+                       for (int i = 1; i < 4; i++) {
+                               struct gmnisrv_client *client =
&server->clients[server->nclients-i];
+                               disconnect_client(server, client);
+                       }
+               }
                return;
        }

--
2.35.1
Details
Message ID
<CO60ZJNRZ6AX.132I41GG83IQV@taiga>
In-Reply-To
<CACoVjN0sjQUcB=ZK=TtakM05dEVxDeOpiTbOBqshG6RkiyLq9g@mail.gmail.com> (view parent)
DKIM signature
pass
Download raw message
Was this patch prepared with git send-email? It's not valid.
Reply to thread Export thread (mbox)