Skip to content

Commit

Permalink
Allow setting TimeSpan.Zero as a heartbeat timeout value
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebakken committed Jan 24, 2025
1 parent 9c6fda8 commit 276c9a6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions projects/RabbitMQ.Client/Impl/SocketFrameHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,11 @@ public TimeSpan ReadTimeout
{
try
{
_socket.ReceiveTimeout = value;
_stream.ReadTimeout = (int)value.TotalMilliseconds;
if (value != default)
{
_socket.ReceiveTimeout = value;
_stream.ReadTimeout = (int)value.TotalMilliseconds;
}
}
catch (SocketException)
{
Expand All @@ -125,8 +128,11 @@ public TimeSpan WriteTimeout
{
set
{
_socket.Client.SendTimeout = (int)value.TotalMilliseconds;
_stream.WriteTimeout = (int)value.TotalMilliseconds;
if (value != default)
{
_socket.Client.SendTimeout = (int)value.TotalMilliseconds;
_stream.WriteTimeout = (int)value.TotalMilliseconds;
}
}
}

Expand Down

0 comments on commit 276c9a6

Please sign in to comment.