Client: Update IsConnected on EndReceive socket exception

This commit is contained in:
Tal Aloni 2024-07-27 19:51:42 +03:00
parent 5c4e369896
commit b0912850dd
2 changed files with 6 additions and 0 deletions

View file

@ -436,17 +436,20 @@ namespace SMBLibrary.Client
} }
catch (ArgumentException) // The IAsyncResult object was not returned from the corresponding synchronous method on this class. catch (ArgumentException) // The IAsyncResult object was not returned from the corresponding synchronous method on this class.
{ {
m_isConnected = false;
state.ReceiveBuffer.Dispose(); state.ReceiveBuffer.Dispose();
return; return;
} }
catch (ObjectDisposedException) catch (ObjectDisposedException)
{ {
m_isConnected = false;
Log("[ReceiveCallback] EndReceive ObjectDisposedException"); Log("[ReceiveCallback] EndReceive ObjectDisposedException");
state.ReceiveBuffer.Dispose(); state.ReceiveBuffer.Dispose();
return; return;
} }
catch (SocketException ex) catch (SocketException ex)
{ {
m_isConnected = false;
Log("[ReceiveCallback] EndReceive SocketException: " + ex.Message); Log("[ReceiveCallback] EndReceive SocketException: " + ex.Message);
state.ReceiveBuffer.Dispose(); state.ReceiveBuffer.Dispose();
return; return;

View file

@ -369,17 +369,20 @@ namespace SMBLibrary.Client
} }
catch (ArgumentException) // The IAsyncResult object was not returned from the corresponding synchronous method on this class. catch (ArgumentException) // The IAsyncResult object was not returned from the corresponding synchronous method on this class.
{ {
m_isConnected = false;
state.ReceiveBuffer.Dispose(); state.ReceiveBuffer.Dispose();
return; return;
} }
catch (ObjectDisposedException) catch (ObjectDisposedException)
{ {
m_isConnected = false;
Log("[ReceiveCallback] EndReceive ObjectDisposedException"); Log("[ReceiveCallback] EndReceive ObjectDisposedException");
state.ReceiveBuffer.Dispose(); state.ReceiveBuffer.Dispose();
return; return;
} }
catch (SocketException ex) catch (SocketException ex)
{ {
m_isConnected = false;
Log("[ReceiveCallback] EndReceive SocketException: " + ex.Message); Log("[ReceiveCallback] EndReceive SocketException: " + ex.Message);
state.ReceiveBuffer.Dispose(); state.ReceiveBuffer.Dispose();
return; return;