Skip to content

Commit f10db03

Browse files
committed
Gracefully terminate stream reaader
when the client forcefully terminates TCP connection Also improve logging.
1 parent d6301a3 commit f10db03

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

deps/rabbitmq_stream/src/rabbit_stream_reader.erl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,8 +1007,8 @@ open(cast,
10071007
SendFileOct)
10081008
of
10091009
{error, closed} ->
1010-
rabbit_log:info("Stream protocol connection has been closed by peer", []),
1011-
throw({stop, connection_closed});
1010+
rabbit_log_connection:info("Stream protocol connection has been closed by peer", []),
1011+
throw({stop, normal});
10121012
{error, Reason} ->
10131013
rabbit_log_connection:info("Error while sending chunks: ~p",
10141014
[Reason]),
@@ -1825,8 +1825,8 @@ handle_frame_post_auth(Transport,
18251825

18261826
case send_chunks(Transport, ConsumerState, SendFileOct) of
18271827
{error, closed} ->
1828-
rabbit_log:info("Stream protocol connection has been closed by peer", []),
1829-
throw({stop, connection_closed});
1828+
rabbit_log_connection:info("Stream protocol connection has been closed by peer", []),
1829+
throw({stop, normal});
18301830
{{segment, Segment1}, {credit, Credit1}} ->
18311831
ConsumerState1 =
18321832
ConsumerState#consumer{segment = Segment1,
@@ -1900,8 +1900,8 @@ handle_frame_post_auth(Transport,
19001900
SendFileOct)
19011901
of
19021902
{error, closed} ->
1903-
rabbit_log:warning("Stream protocol connection has been closed by peer", []),
1904-
throw({stop, connection_closed});
1903+
rabbit_log_connection:info("Stream protocol connection has been closed by peer", []),
1904+
throw({stop, normal});
19051905
{{segment, Segment1}, {credit, Credit1}} ->
19061906
Consumer1 =
19071907
Consumer#consumer{segment = Segment1, credit = Credit1},

0 commit comments

Comments
 (0)