summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Radestock <matthias@rabbitmq.com>2013-02-25 10:32:29 +0000
committerMatthias Radestock <matthias@rabbitmq.com>2013-02-25 10:32:29 +0000
commit54529e84ae3d00fa24a2040fe9a1e342d3be5bba (patch)
tree310514496f32f093473dcf5590505da179f4bfdb
parentaf2d744f2140172519471669d4f7cb2e1447183f (diff)
downloadrabbitmq-server-54529e84ae3d00fa24a2040fe9a1e342d3be5bba.tar.gz
continue accepting when client sends RST before we accepted
-rw-r--r--src/tcp_acceptor.erl12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/tcp_acceptor.erl b/src/tcp_acceptor.erl
index 0248f878..c76681c2 100644
--- a/src/tcp_acceptor.erl
+++ b/src/tcp_acceptor.erl
@@ -61,15 +61,13 @@ handle_info({inet_async, LSock, Ref, {ok, Sock}},
%% accept more
accept(State);
-handle_info({inet_async, LSock, Ref, {error, closed}},
- State=#state{sock=LSock, ref=Ref}) ->
- %% It would be wrong to attempt to restart the acceptor when we
- %% know this will fail.
- {stop, normal, State};
-
handle_info({inet_async, LSock, Ref, {error, Reason}},
State=#state{sock=LSock, ref=Ref}) ->
- {stop, {accept_failed, Reason}, State};
+ case Reason of
+ closed -> {stop, normal, State}; %% listening socket closed
+ econnaborted -> accept(State); %% client sent RST before we accepted
+ _ -> {stop, {accept_failed, Reason}, State}
+ end;
handle_info(_Info, State) ->
{noreply, State}.