Skip to content

Commit 5b03d35

Browse files
Set up stream timeouts as early as possible
The patch by Jonathan Oliver.
1 parent 1b63f5b commit 5b03d35

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

projects/client/RabbitMQ.Client/src/client/api/SslHelper.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ private bool CertificateValidationCallback(object sender,
8787

8888
///<summary>Upgrade a Tcp stream to an Ssl stream using the SSL options
8989
///provided</summary>
90-
public static Stream TcpUpgrade(Stream tcpStream, SslOption sslOption, int timeout)
90+
public static Stream TcpUpgrade(Stream tcpStream, SslOption sslOption)
9191
{
9292
SslHelper helper = new SslHelper(sslOption);
9393

@@ -104,8 +104,6 @@ public static Stream TcpUpgrade(Stream tcpStream, SslOption sslOption, int timeo
104104
sslOption.Certs,
105105
sslOption.Version,
106106
false);
107-
sslStream.ReadTimeout = timeout;
108-
sslStream.WriteTimeout = timeout;
109107

110108
return sslStream;
111109
}

projects/client/RabbitMQ.Client/src/client/impl/SocketFrameHandler.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,14 @@ public SocketFrameHandler(AmqpTcpEndpoint endpoint,
9494
}
9595

9696
Stream netstream = m_socket.GetStream();
97+
netstream.ReadTimeout = timeout;
98+
netstream.WriteTimeout = timeout;
99+
97100
if (endpoint.Ssl.Enabled)
98101
{
99102
try
100103
{
101-
netstream = SslHelper.TcpUpgrade(netstream, endpoint.Ssl, timeout);
104+
netstream = SslHelper.TcpUpgrade(netstream, endpoint.Ssl);
102105
}
103106
catch (Exception)
104107
{

0 commit comments

Comments
 (0)