This is an automated email from the ASF dual-hosted git repository.

blankensteiner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-dotpulsar.git


The following commit(s) were added to refs/heads/master by this push:
     new 469ac89  Setting ReceiveTimeout and SendTimeout on TcpClient to 30 
seconds. Hoping this will stop 'AuthenticateAsClientAsync' from hanging after 
networking issues,
469ac89 is described below

commit 469ac8944ba05c436f35aa2c4eb840ddaadccc4d
Author: Daniel Blankensteiner <[email protected]>
AuthorDate: Mon Jul 15 14:36:17 2024 +0200

    Setting ReceiveTimeout and SendTimeout on TcpClient to 30 seconds. Hoping 
this will stop 'AuthenticateAsClientAsync' from hanging after networking issues,
---
 CHANGELOG.md                        | 4 ++++
 src/DotPulsar/Internal/Connector.cs | 6 +++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 36cfe8f..71597f2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/src/DotPulsar/Internal/Connector.cs 
b/src/DotPulsar/Internal/Connector.cs
index 51be8b5..6c8964b 100644
--- a/src/DotPulsar/Internal/Connector.cs
+++ b/src/DotPulsar/Internal/Connector.cs
@@ -62,7 +62,11 @@ public sealed class Connector
 
     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
         {

Reply via email to