File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
projects/client/RabbitMQ.Client/src/client/impl Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,10 @@ public class SocketFrameHandler : IFrameHandler
53
53
{
54
54
// Timeout in seconds to wait for a clean socket close.
55
55
public const int SOCKET_CLOSING_TIMEOUT = 1 ;
56
+ // Socket poll timeout in ms. If the socket does not
57
+ // become writeable in this amount of time, we throw
58
+ // an exception.
59
+ protected int m_writeableStateTimeout = 30000 ;
56
60
57
61
public NetworkBinaryReader m_reader ;
58
62
public TcpClient m_socket ;
@@ -143,6 +147,7 @@ public int Timeout
143
147
{
144
148
// make sure the socket timeout is greater than heartbeat interval
145
149
m_socket . ReceiveTimeout = value * 4 ;
150
+ m_writeableStateTimeout = value * 4 ;
146
151
}
147
152
}
148
153
#pragma warning disable 0168
@@ -218,7 +223,7 @@ public void WriteFrame(Frame frame)
218
223
{
219
224
lock ( m_writer )
220
225
{
221
- m_socket . Client . Poll ( - 1 , SelectMode . SelectWrite ) ;
226
+ m_socket . Client . Poll ( m_writeableStateTimeout , SelectMode . SelectWrite ) ;
222
227
frame . WriteTo ( m_writer ) ;
223
228
m_writer . Flush ( ) ;
224
229
}
@@ -228,7 +233,7 @@ public void WriteFrameSet(IList<Frame> frames)
228
233
{
229
234
lock ( m_writer )
230
235
{
231
- m_socket . Client . Poll ( - 1 , SelectMode . SelectWrite ) ;
236
+ m_socket . Client . Poll ( m_writeableStateTimeout , SelectMode . SelectWrite ) ;
232
237
foreach ( var f in frames )
233
238
{
234
239
f . WriteTo ( m_writer ) ;
You can’t perform that action at this time.
0 commit comments