Skip to content

Commit

Permalink
Setting ReceiveTimeout and SendTimeout on TcpClient to 30 seconds. Ho…
Browse files Browse the repository at this point in the history
…ping this will stop 'AuthenticateAsClientAsync' from hanging after networking issues,
  • Loading branch information
blankensteiner committed Jul 15, 2024
1 parent 37ac33e commit 469ac89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)

- Updated the Microsoft.Extensions.ObjectPool dependency from version 8.0.6 to 8.0.7

### Fixed

- Under some circumstances 'AuthenticateAsClientAsync' will hang after a network issue. Setting the receive and send timeouts on the TCP client should fix this

## [3.3.1] - 2024-06-24

### Added
Expand Down
6 changes: 5 additions & 1 deletion src/DotPulsar/Internal/Connector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ public async Task<Stream> Connect(Uri serviceUrl, CancellationToken cancellation

private static async Task<Stream> GetStream(string host, int port, CancellationToken cancellationToken)
{
var tcpClient = new TcpClient();
var tcpClient = new TcpClient
{
ReceiveTimeout = 30000,
SendTimeout = 30000
};

try
{
Expand Down

0 comments on commit 469ac89

Please sign in to comment.