Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
14 changes: 14 additions & 0 deletions projects/Test/Integration/GH/TestGitHubIssues.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,19 @@ public async Task TestBasicConsumeCancellation_GH1750()

Assert.False(sawConnectionShutdown);
}

[Fact]
public async Task TestHeartbeatTimeoutValue_GH1756()
{
var connectionFactory = new ConnectionFactory
{
AutomaticRecoveryEnabled = true,
RequestedHeartbeat = TimeSpan.Zero,
};

_conn = await connectionFactory.CreateConnectionAsync("some-name");

Assert.True(_conn.Heartbeat != default);
}
}
}
Loading