diff options
author | Karl Nilsson <kjnilsson@gmail.com> | 2021-10-11 13:30:27 +0100 |
---|---|---|
committer | Karl Nilsson <kjnilsson@gmail.com> | 2021-10-13 14:30:46 +0100 |
commit | 3f667a3cb83103b2de54d20bbf059606e629523e (patch) | |
tree | 5c411d86d422f22743e82ffaf3ad92dea1edfa21 | |
parent | 92f83a1af091cb0d2e1344efac02cd9286c40920 (diff) | |
download | rabbitmq-server-git-3f667a3cb83103b2de54d20bbf059606e629523e.tar.gz |
amqp10_client: make shutdown scenarios a bit less noisyimprove-amqp-10-stream-support
by handling specific EXIT and DOWN messages that may occur during
certain connection closure cases.
-rw-r--r-- | deps/amqp10_client/src/amqp10_client_connection.erl | 11 | ||||
-rw-r--r-- | deps/amqp10_client/src/amqp10_client_session.erl | 3 | ||||
-rw-r--r-- | deps/rabbitmq_codegen/.DS_Store | bin | 6148 -> 0 bytes |
3 files changed, 10 insertions, 4 deletions
diff --git a/deps/amqp10_client/src/amqp10_client_connection.erl b/deps/amqp10_client/src/amqp10_client_connection.erl index c56cde2c6e..3a168e3f9b 100644 --- a/deps/amqp10_client/src/amqp10_client_connection.erl +++ b/deps/amqp10_client/src/amqp10_client_connection.erl @@ -92,8 +92,6 @@ -export_type([connection_config/0, amqp10_socket/0]). --define(DEFAULT_TIMEOUT, 5000). - %% ------------------------------------------------------------------- %% Public API. %% ------------------------------------------------------------------- @@ -257,7 +255,7 @@ open_sent(_EvtType, #'v1_0.open'{max_frame_size = MFSz, S2 end, State1, PendingSessionReqs), ok = notify_opened(Config), - {next_state, opened, State2}; + {next_state, opened, State2#state{pending_session_reqs = []}}; open_sent({call, From}, begin_session, #state{pending_session_reqs = PendingSessionReqs} = State) -> State1 = State#state{pending_session_reqs = [From | PendingSessionReqs]}, @@ -297,6 +295,13 @@ opened(_EvtType, Frame, State) -> close_sent(_EvtType, heartbeat, State) -> {next_state, close_sent, State}; +close_sent(_EvtType, {'EXIT', _Pid, shutdown}, State) -> + %% monitored processes may exit during closure + {next_state, close_sent, State}; +close_sent(_EvtType, {'DOWN', _Ref, process, ReaderPid, _}, + #state{reader = ReaderPid} = State) -> + %% if the reader exits we probably wont receive a close frame + {stop, normal, State}; close_sent(_EvtType, #'v1_0.close'{}, State) -> %% TODO: we should probably set up a timer before this to ensure %% we close down event if no reply is received diff --git a/deps/amqp10_client/src/amqp10_client_session.erl b/deps/amqp10_client/src/amqp10_client_session.erl index 09a06fb3a6..83567b74d6 100644 --- a/deps/amqp10_client/src/amqp10_client_session.erl +++ b/deps/amqp10_client/src/amqp10_client_session.erl @@ -957,7 +957,8 @@ amqp10_session_event(Evt) -> socket_send(Sock, Data) -> case socket_send0(Sock, Data) of ok -> ok; - {error, Reason} -> exit({socket_closed, Reason}) + {error, _Reason} -> + throw({stop, normal}) end. -dialyzer({no_fail_call, socket_send0/2}). diff --git a/deps/rabbitmq_codegen/.DS_Store b/deps/rabbitmq_codegen/.DS_Store Binary files differdeleted file mode 100644 index 8fa6166683..0000000000 --- a/deps/rabbitmq_codegen/.DS_Store +++ /dev/null |