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 92a2f4d7..b9ed6999 100644
--- a/src/rabbit_reader.erl
+++ b/src/rabbit_reader.erl
@@ -364,7 +364,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),