File tree 2 files changed +24
-4
lines changed
2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -111,8 +111,11 @@ public TimeSpan ReadTimeout
111
111
{
112
112
try
113
113
{
114
- _socket . ReceiveTimeout = value ;
115
- _stream . ReadTimeout = ( int ) value . TotalMilliseconds ;
114
+ if ( value != default )
115
+ {
116
+ _socket . ReceiveTimeout = value ;
117
+ _stream . ReadTimeout = ( int ) value . TotalMilliseconds ;
118
+ }
116
119
}
117
120
catch ( SocketException )
118
121
{
@@ -125,8 +128,11 @@ public TimeSpan WriteTimeout
125
128
{
126
129
set
127
130
{
128
- _socket . Client . SendTimeout = ( int ) value . TotalMilliseconds ;
129
- _stream . WriteTimeout = ( int ) value . TotalMilliseconds ;
131
+ if ( value != default )
132
+ {
133
+ _socket . Client . SendTimeout = ( int ) value . TotalMilliseconds ;
134
+ _stream . WriteTimeout = ( int ) value . TotalMilliseconds ;
135
+ }
130
136
}
131
137
}
132
138
Original file line number Diff line number Diff line change @@ -117,5 +117,19 @@ public async Task TestBasicConsumeCancellation_GH1750()
117
117
118
118
Assert . False ( sawConnectionShutdown ) ;
119
119
}
120
+
121
+ [ Fact ]
122
+ public async Task TestHeartbeatTimeoutValue_GH1756 ( )
123
+ {
124
+ var connectionFactory = new ConnectionFactory
125
+ {
126
+ AutomaticRecoveryEnabled = true ,
127
+ RequestedHeartbeat = TimeSpan . Zero ,
128
+ } ;
129
+
130
+ _conn = await connectionFactory . CreateConnectionAsync ( "some-name" ) ;
131
+
132
+ Assert . True ( _conn . Heartbeat != default ) ;
133
+ }
120
134
}
121
135
}
You can’t perform that action at this time.
0 commit comments