summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rabbit_reader.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/rabbit_reader.erl b/src/rabbit_reader.erl
index b5d82ac230..76d392f996 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -357,7 +357,11 @@ mainloop(Deb, State = #v1{parent = Parent, sock= Sock, recv_ref = Ref}) ->
throw({handshake_timeout, State#v1.callback})
end;
timeout ->
- throw({timeout, State#v1.connection_state});
+ ConnectionState = State#v1.connection_state,
+ case ConnectionState of
+ closed -> mainloop(Deb, State);
+ _ -> throw({timeout, ConnectionState})
+ end;
{'$gen_call', From, {shutdown, Explanation}} ->
{ForceTermination, NewState} = terminate(Explanation, State),
gen_server:reply(From, ok),