File tree Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Expand file tree Collapse file tree 2 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -111,8 +111,11 @@ public TimeSpan ReadTimeout
111111 {
112112 try
113113 {
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+ }
116119 }
117120 catch ( SocketException )
118121 {
@@ -125,8 +128,11 @@ public TimeSpan WriteTimeout
125128 {
126129 set
127130 {
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+ }
130136 }
131137 }
132138
Original file line number Diff line number Diff line change @@ -117,5 +117,19 @@ public async Task TestBasicConsumeCancellation_GH1750()
117117
118118 Assert . False ( sawConnectionShutdown ) ;
119119 }
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+ }
120134 }
121135}
You can’t perform that action at this time.
0 commit comments