Skip to content

Commit

Permalink
TCP connection establishment updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-Koifman committed Sep 22, 2023
1 parent 5af0848 commit cd35e1a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
12 changes: 9 additions & 3 deletions Softnet.Proxy/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,25 @@ static class Constants

public static class TcpConnector
{
// Input
// Client Output
public const byte CLIENT_P2P = 1;
// Service Output
public const byte SERVICE_P2P = 2;
// Client Output
public const byte CLIENT_PROXY = 3;
// Service Output
public const byte SERVICE_PROXY = 4;
// Input
public const byte AUTH_HASH = 5;
// Client Output
public const byte P2P_FAILED = 6;

// Output
public const byte ERROR = 10;
public const byte AUTH_KEY = 11;
public const byte CREATE_P2P_CONNECTION = 12;
public const byte CREATE_P2P_CONNECTION_IN_DUAL_MODE = 13;
public const byte CREATE_PROXY_CONNECTION = 14;
public const byte ERROR = 15;
public const byte CREATE_PROXY_CONNECTION = 14;
}

public static class TcpProxy
Expand Down
5 changes: 4 additions & 1 deletion Softnet.Proxy/TcpConnectorV4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,10 @@ void OnMessageReceived(byte[] message)
{
if (message[0] == Constants.TcpConnector.P2P_FAILED)
{
m_TcpControl.OnP2PFailed();
if (m_ConnectorMode == ConnectorMode.SERVICE_P2P)
m_TcpControl.OnP2PFailed();
else
Terminate();
}
else
Terminate();
Expand Down
5 changes: 4 additions & 1 deletion Softnet.Proxy/TcpConnectorV6.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,10 @@ void OnMessageReceived(byte[] message)
{
if (message[0] == Constants.TcpConnector.P2P_FAILED)
{
m_TcpControl.OnP2PFailed();
if (m_ConnectorMode == ConnectorMode.SERVICE_P2P)
m_TcpControl.OnP2PFailed();
else
Terminate();
}
else
Terminate();
Expand Down

0 comments on commit cd35e1a

Please sign in to comment.