Skip to content

Commit 2fd25cb

Browse files
Where appropriate change all -1 and Timespan(0,0,0,-1) to SshNet.Session.Infinite and SshNet.Session.InfiniteTimeSpan
1 parent 8854821 commit 2fd25cb

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/Renci.SshNet.Tests/Classes/Channels/ChannelDirectTcpipTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void SocketShouldBeClosedAndBindShouldEndWhenForwardedPortSignalsClosingE
5757
new MessageEventArgs<ChannelOpenConfirmationMessage>(
5858
new ChannelOpenConfirmationMessage(((ChannelOpenMessage)m).LocalChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
5959
_sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
60-
.Callback<WaitHandle>(p => p.WaitOne(-1));
60+
.Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
6161

6262
var localPortEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
6363
using (var localPortListener = new AsyncSocketListener(localPortEndPoint))
@@ -107,7 +107,7 @@ public void SocketShouldBeClosedAndBindShouldEndWhenOnErrorOccurredIsInvoked()
107107
new MessageEventArgs<ChannelOpenConfirmationMessage>(
108108
new ChannelOpenConfirmationMessage(((ChannelOpenMessage)m).LocalChannelNumber, _remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
109109
_sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
110-
.Callback<WaitHandle>(p => p.WaitOne(-1));
110+
.Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
111111

112112
var localPortEndPoint = new IPEndPoint(IPAddress.Loopback, 8122);
113113
using (var localPortListener = new AsyncSocketListener(localPortEndPoint))
@@ -159,7 +159,7 @@ public void SocketShouldBeClosedAndEofShouldBeSentToServerWhenClientShutsDownSoc
159159
new ChannelOpenConfirmationMessage(((ChannelOpenMessage) m).LocalChannelNumber,
160160
_remoteWindowSize, _remotePacketSize, _remoteChannelNumber))));
161161
_sessionMock.Setup(p => p.WaitOnHandle(It.IsAny<EventWaitHandle>()))
162-
.Callback<WaitHandle>(p => p.WaitOne(-1));
162+
.Callback<WaitHandle>(p => p.WaitOne(Session.Infinite));
163163
_sessionMock.Setup(p => p.ConnectionInfo).Returns(_connectionInfoMock.Object);
164164
_connectionInfoMock.Setup(p => p.Timeout).Returns(TimeSpan.FromSeconds(60));
165165
_sessionMock.Setup(p => p.TrySendMessage(It.IsAny<ChannelEofMessage>()))

src/Renci.SshNet/NetConfClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private NetConfClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo)
126126
internal NetConfClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory)
127127
: base(connectionInfo, ownsConnectionInfo, serviceFactory)
128128
{
129-
OperationTimeout = new TimeSpan(0, 0, 0, 0, -1);
129+
OperationTimeout = SshNet.Session.InfiniteTimeSpan;
130130
AutomaticMessageIdHandling = true;
131131
}
132132

src/Renci.SshNet/ScpClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private ScpClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo)
144144
internal ScpClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory)
145145
: base(connectionInfo, ownsConnectionInfo, serviceFactory)
146146
{
147-
OperationTimeout = new TimeSpan(0, 0, 0, 0, -1);
147+
OperationTimeout = SshNet.Session.InfiniteTimeSpan;
148148
BufferSize = 1024 * 16;
149149

150150
if (_byteToChar == null)

src/Renci.SshNet/SftpClient.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ private SftpClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo)
229229
internal SftpClient(ConnectionInfo connectionInfo, bool ownsConnectionInfo, IServiceFactory serviceFactory)
230230
: base(connectionInfo, ownsConnectionInfo, serviceFactory)
231231
{
232-
OperationTimeout = new TimeSpan(0, 0, 0, 0, -1);
232+
OperationTimeout = SshNet.Session.InfiniteTimeSpan;
233233
BufferSize = 1024 * 32;
234234
}
235235

src/Renci.SshNet/SshCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ internal SshCommand(ISession session, string commandText, Encoding encoding)
143143
_session = session;
144144
CommandText = commandText;
145145
_encoding = encoding;
146-
CommandTimeout = new TimeSpan(0, 0, 0, 0, -1);
146+
CommandTimeout = SshNet.Session.InfiniteTimeSpan;
147147
_sessionErrorOccuredWaitHandle = new AutoResetEvent(false);
148148

149149
_session.Disconnected += Session_Disconnected;

0 commit comments

Comments
 (0)