Skip to content
Open
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
20 changes: 20 additions & 0 deletions src/Renci.SshNet/ConnectionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

private TimeSpan _timeout;
private TimeSpan _channelCloseTimeout;
private TimeSpan _sendTimeout = System.Threading.Timeout.InfiniteTimeSpan;

/// <summary>
/// Gets supported key exchange algorithms for this connection.
Expand Down Expand Up @@ -191,6 +192,25 @@
}
}

/// <summary>
/// Gets or sets the socket send timeout. Controls how long a socket send may block before
/// throwing a <see cref="System.Net.Sockets.SocketException"/>. The default value is
/// <see cref="Timeout.InfiniteTimeSpan"/> (no timeout).

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows Integration Tests .NET Framework

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Linux

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Linux

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved

Check failure on line 198 in src/Renci.SshNet/ConnectionInfo.cs

View workflow job for this annotation

GitHub Actions / Windows Integration Tests .NET

XML comment has cref attribute 'InfiniteTimeSpan' that could not be resolved
/// </summary>
public TimeSpan SendTimeout
{
get
{
return _sendTimeout;
}
set
{
value.EnsureValidTimeout(nameof(SendTimeout));

_sendTimeout = value;
}
}

/// <summary>
/// Gets or sets the character encoding.
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions src/Renci.SshNet/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,8 @@ public void Connect()
_socket = _serviceFactory.CreateConnector(ConnectionInfo, _socketFactory)
.Connect(ConnectionInfo);

_socket.SendTimeout = ConnectionInfo.SendTimeout.AsTimeout();

var serverIdentification = _serviceFactory.CreateProtocolVersionExchange()
.Start(ClientVersion, _socket, ConnectionInfo.Timeout);

Expand Down Expand Up @@ -727,6 +729,8 @@ public async Task ConnectAsync(CancellationToken cancellationToken)
_socket = await _serviceFactory.CreateConnector(ConnectionInfo, _socketFactory)
.ConnectAsync(ConnectionInfo, cancellationToken).ConfigureAwait(false);

_socket.SendTimeout = ConnectionInfo.SendTimeout.AsTimeout();

var serverIdentification = await _serviceFactory.CreateProtocolVersionExchange()
.StartAsync(ClientVersion, _socket, cancellationToken).ConfigureAwait(false);

Expand Down
Loading