Browse Source

Don't suppress exceptions

It is better to log them.

Signed-off-by: Syrone Wong <wong.syrone@gmail.com>
tags/3.3.2
Syrone Wong 8 years ago
parent
commit
d5f24df128
2 changed files with 9 additions and 9 deletions
  1. +5
    -5
      shadowsocks-csharp/Controller/Service/TCPRelay.cs
  2. +4
    -4
      shadowsocks-csharp/Proxy/DirectConnect.cs

+ 5
- 5
shadowsocks-csharp/Controller/Service/TCPRelay.cs View File

@@ -218,8 +218,8 @@ namespace Shadowsocks.Controller
}
try
{
_connection?.Shutdown(SocketShutdown.Both);
_connection?.Close();
_connection.Shutdown(SocketShutdown.Both);
_connection.Close();
}
catch (Exception e)
{
@@ -227,9 +227,9 @@ namespace Shadowsocks.Controller
}
try
{
var remote = _currentRemoteSession?.Remote;
remote?.Shutdown(SocketShutdown.Both);
remote?.Close();
var remote = _currentRemoteSession.Remote;
remote.Shutdown(SocketShutdown.Both);
remote.Close();
}
catch (Exception e)
{


+ 4
- 4
shadowsocks-csharp/Proxy/DirectConnect.cs View File

@@ -67,7 +67,7 @@ namespace Shadowsocks.Proxy
public void BeginSend(byte[] buffer, int offset, int size, SocketFlags socketFlags, AsyncCallback callback,
object state)
{
_remote?.BeginSend(buffer, offset, size, socketFlags, callback, state);
_remote.BeginSend(buffer, offset, size, socketFlags, callback, state);
}

public int EndSend(IAsyncResult asyncResult)
@@ -78,7 +78,7 @@ namespace Shadowsocks.Proxy
public void BeginReceive(byte[] buffer, int offset, int size, SocketFlags socketFlags, AsyncCallback callback,
object state)
{
_remote?.BeginReceive(buffer, offset, size, socketFlags, callback, state);
_remote.BeginReceive(buffer, offset, size, socketFlags, callback, state);
}

public int EndReceive(IAsyncResult asyncResult)
@@ -88,12 +88,12 @@ namespace Shadowsocks.Proxy

public void Shutdown(SocketShutdown how)
{
_remote?.Shutdown(how);
_remote.Shutdown(how);
}

public void Close()
{
_remote?.Dispose();
_remote.Dispose();
}
}
}

Loading…
Cancel
Save