@@ -638,10 +638,11 @@ log_error_and_close_session(
638638 Error , State = # state {cfg = # cfg {reader_pid = ReaderPid ,
639639 writer_pid = WriterPid ,
640640 channel_num = Ch }}) ->
641- End = # 'v1_0.end' {error = Error },
642641 ? LOG_WARNING (" Closing session for connection ~p : ~tp " ,
643642 [ReaderPid , Error ]),
644- ok = rabbit_amqp_writer :send_command_sync (WriterPid , Ch , End ),
643+ rabbit_amqp_reader :notify_session_ending (ReaderPid , self (), Ch ),
644+ ok = rabbit_amqp_writer :send_command_sync (
645+ WriterPid , Ch , # 'v1_0.end' {error = Error }),
645646 {stop , {shutdown , Error }, State }.
646647
647648% % Batch confirms / rejects to publishers.
@@ -1178,9 +1179,11 @@ handle_frame(Detach = #'v1_0.detach'{handle = ?UINT(HandleInt)},
11781179 reply_frames (Reply , State );
11791180
11801181handle_frame (# 'v1_0.end' {},
1181- State0 = # state {cfg = # cfg {writer_pid = WriterPid ,
1182+ State0 = # state {cfg = # cfg {reader_pid = ReaderPid ,
1183+ writer_pid = WriterPid ,
11821184 channel_num = Ch }}) ->
11831185 State = send_delivery_state_changes (State0 ),
1186+ rabbit_amqp_reader :notify_session_ending (ReaderPid , self (), Ch ),
11841187 ok = try rabbit_amqp_writer :send_command_sync (WriterPid , Ch , # 'v1_0.end' {})
11851188 catch exit :{Reason , {gen_server , call , _ArgList }}
11861189 when Reason =:= shutdown orelse
0 commit comments