[erlang-patches] [PATCH] Exit if an error occurs with the listening socket

Björn Gustavsson bgustavsson@REDACTED
Tue Mar 30 11:58:48 CEST 2010


2010/3/22 Björn Gustavsson <bgustavsson@REDACTED>:
> On Sun, Mar 21, 2010 at 2:30 AM, Michael Santos
> <michael.santos@REDACTED> wrote:
>> Check errno if either select() or accept() returns an error and exit.
>> This prevents epmd from looping and taking up 100% CPU.
>
> Thanks! Will include in 'pu'.

I did not build on Windows. I have added an additional
commit that fixes that. I intend to squash that commit into
your commit if/when the branch is graduated.

Are there other platforms that don't have ECONNABORTED
defined?

diff --git a/erts/epmd/src/epmd_srv.c b/erts/epmd/src/epmd_srv.c
index 7e4a661..83ebdaa 100644
--- a/erts/epmd/src/epmd_srv.c
+++ b/erts/epmd/src/epmd_srv.c
@@ -411,7 +411,9 @@ static int do_accept(EpmdVars *g,int listensock)
         dbg_perror(g,"error in accept");
         switch (errno) {
             case EAGAIN:
+#ifndef __WIN32__
             case ECONNABORTED:
+#endif
             case EINTR:
                    return EPMD_FALSE;
             default:


-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB


More information about the erlang-patches mailing list