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

Michael Santos michael.santos@REDACTED
Tue Mar 30 15:28:13 CEST 2010


On Tue, Mar 30, 2010 at 11:58:48AM +0200, Bj??rn Gustavsson wrote:
> 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?

Yay, I broke the Windows build! ;) Thanks for fixing the patch.

Looking through erts/emulator/drivers/common/inet_drv.c, the only platform
for which ECONNABORTED is explicitly handled is Windows:

#ifdef __WIN32__
#define ECONNABORTED            WSAECONNABORTED
#endif /* __WIN32__ */


> 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:




More information about the erlang-patches mailing list