File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
projects/client/RabbitMQ.Client/src/client/impl Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -550,9 +550,10 @@ public void HeartbeatReadLoop()
550
550
// Has to miss two full heartbeats to force socket close
551
551
if ( m_missedHeartbeats > 1 )
552
552
{
553
- EndOfStreamException eose = new EndOfStreamException (
554
- "Heartbeat missing with heartbeat == " +
555
- m_heartbeat + " seconds" ) ;
553
+ String description = "Heartbeat missing with heartbeat == " +
554
+ m_heartbeat + " seconds" ;
555
+ EndOfStreamException eose = new EndOfStreamException ( description ) ;
556
+ m_shutdownReport . Add ( new ShutdownReportEntry ( description , eose ) ) ;
556
557
HandleMainLoopException ( new ShutdownEventArgs (
557
558
ShutdownInitiator . Library ,
558
559
0 ,
Original file line number Diff line number Diff line change @@ -59,6 +59,8 @@ public class SocketFrameHandler_0_9 : IFrameHandler
59
59
public TcpClient m_socket ;
60
60
public NetworkBinaryReader m_reader ;
61
61
public NetworkBinaryWriter m_writer ;
62
+ private bool m_closed = false ;
63
+ private Object m_semaphore = new object ( ) ;
62
64
63
65
public SocketFrameHandler_0_9 ( AmqpTcpEndpoint endpoint )
64
66
{
@@ -150,8 +152,15 @@ public void WriteFrame(Frame frame)
150
152
151
153
public void Close ( )
152
154
{
153
- m_socket . LingerState = new LingerOption ( true , SOCKET_CLOSING_TIMEOUT ) ;
154
- m_socket . Close ( ) ;
155
+ lock ( m_semaphore )
156
+ {
157
+ if ( ! m_closed )
158
+ {
159
+ m_socket . LingerState = new LingerOption ( true , SOCKET_CLOSING_TIMEOUT ) ;
160
+ m_socket . Close ( ) ;
161
+ m_closed = true ;
162
+ }
163
+ }
155
164
}
156
165
}
157
166
}
You can’t perform that action at this time.
0 commit comments