mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 14:45:51 +03:00
ISocketManager.OnDisconnected is in charge of calling Connection.Close so custom parameters can be used
This commit is contained in:
parent
5fdffff5c4
commit
498c1b9a32
@ -16,7 +16,7 @@ public interface ISocketManager
|
||||
void OnConnected( Connection connection, ConnectionInfo info );
|
||||
|
||||
/// <summary>
|
||||
/// Called when the connection leaves
|
||||
/// Called when the connection leaves. Must call Close on the connection
|
||||
/// </summary>
|
||||
void OnDisconnected( Connection connection, ConnectionInfo info );
|
||||
|
||||
|
@ -50,6 +50,7 @@ public virtual void OnConnectionChanged( Connection connection, ConnectionInfo i
|
||||
if ( !Connecting.Contains( connection ) )
|
||||
{
|
||||
Connecting.Add( connection );
|
||||
|
||||
OnConnecting( connection, info );
|
||||
}
|
||||
break;
|
||||
@ -67,6 +68,9 @@ public virtual void OnConnectionChanged( Connection connection, ConnectionInfo i
|
||||
case ConnectionState.None:
|
||||
if ( Connecting.Contains( connection ) || Connected.Contains( connection ) )
|
||||
{
|
||||
Connecting.Remove( connection );
|
||||
Connected.Remove( connection );
|
||||
|
||||
OnDisconnected( connection, info );
|
||||
}
|
||||
break;
|
||||
@ -81,7 +85,6 @@ public virtual void OnConnecting( Connection connection, ConnectionInfo info )
|
||||
if ( Interface != null )
|
||||
{
|
||||
Interface.OnConnecting( connection, info );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -106,12 +109,14 @@ public virtual void OnDisconnected( Connection connection, ConnectionInfo info )
|
||||
{
|
||||
SteamNetworkingSockets.Internal.SetConnectionPollGroup( connection, 0 );
|
||||
|
||||
connection.Close();
|
||||
|
||||
Connecting.Remove( connection );
|
||||
Connected.Remove( connection );
|
||||
|
||||
Interface?.OnDisconnected( connection, info );
|
||||
if ( Interface != null )
|
||||
{
|
||||
Interface.OnDisconnected( connection, info );
|
||||
}
|
||||
else
|
||||
{
|
||||
connection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public void Receive( int bufferSize = 32 )
|
||||
|
Loading…
Reference in New Issue
Block a user