Client: Use static readonly ResponseTimeoutInMilliseconds instead of cost

This commit is contained in:
Tal Aloni 2021-10-19 20:30:38 +03:00
parent 4ffd9ef128
commit 557936fbab
2 changed files with 4 additions and 4 deletions

View file

@ -27,6 +27,7 @@ namespace SMBLibrary.Client
private static readonly ushort ClientMaxBufferSize = 65535; // Valid range: 512 - 65535
private static readonly ushort ClientMaxMpxCount = 1;
private static readonly int ResponseTimeoutInMilliseconds = 5000;
private SMBTransportType m_transport;
private bool m_isConnected;
@ -536,10 +537,9 @@ namespace SMBLibrary.Client
internal SMB1Message WaitForMessage(CommandName commandName)
{
const int TimeOut = 5000;
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
while (stopwatch.ElapsedMilliseconds < TimeOut)
while (stopwatch.ElapsedMilliseconds < ResponseTimeoutInMilliseconds)
{
lock (m_incomingQueueLock)
{

View file

@ -25,6 +25,7 @@ namespace SMBLibrary.Client
public static readonly uint ClientMaxReadSize = 1048576;
public static readonly uint ClientMaxWriteSize = 1048576;
private static readonly ushort DesiredCredits = 16;
public static readonly int ResponseTimeoutInMilliseconds = 5000;
private string m_serverName;
private SMBTransportType m_transport;
@ -485,10 +486,9 @@ namespace SMBLibrary.Client
internal SMB2Command WaitForCommand(ulong messageID)
{
const int TimeOut = 5000;
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
while (stopwatch.ElapsedMilliseconds < TimeOut)
while (stopwatch.ElapsedMilliseconds < ResponseTimeoutInMilliseconds)
{
lock (m_incomingQueueLock)
{