mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-27 07:05:50 +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 );
|
void OnConnected( Connection connection, ConnectionInfo info );
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Called when the connection leaves
|
/// Called when the connection leaves. Must call Close on the connection
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void OnDisconnected( Connection connection, ConnectionInfo info );
|
void OnDisconnected( Connection connection, ConnectionInfo info );
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ public virtual void OnConnectionChanged( Connection connection, ConnectionInfo i
|
|||||||
if ( !Connecting.Contains( connection ) )
|
if ( !Connecting.Contains( connection ) )
|
||||||
{
|
{
|
||||||
Connecting.Add( connection );
|
Connecting.Add( connection );
|
||||||
|
|
||||||
OnConnecting( connection, info );
|
OnConnecting( connection, info );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -67,6 +68,9 @@ public virtual void OnConnectionChanged( Connection connection, ConnectionInfo i
|
|||||||
case ConnectionState.None:
|
case ConnectionState.None:
|
||||||
if ( Connecting.Contains( connection ) || Connected.Contains( connection ) )
|
if ( Connecting.Contains( connection ) || Connected.Contains( connection ) )
|
||||||
{
|
{
|
||||||
|
Connecting.Remove( connection );
|
||||||
|
Connected.Remove( connection );
|
||||||
|
|
||||||
OnDisconnected( connection, info );
|
OnDisconnected( connection, info );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -81,7 +85,6 @@ public virtual void OnConnecting( Connection connection, ConnectionInfo info )
|
|||||||
if ( Interface != null )
|
if ( Interface != null )
|
||||||
{
|
{
|
||||||
Interface.OnConnecting( connection, info );
|
Interface.OnConnecting( connection, info );
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -106,12 +109,14 @@ public virtual void OnDisconnected( Connection connection, ConnectionInfo info )
|
|||||||
{
|
{
|
||||||
SteamNetworkingSockets.Internal.SetConnectionPollGroup( connection, 0 );
|
SteamNetworkingSockets.Internal.SetConnectionPollGroup( connection, 0 );
|
||||||
|
|
||||||
|
if ( Interface != null )
|
||||||
|
{
|
||||||
|
Interface.OnDisconnected( connection, info );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
connection.Close();
|
connection.Close();
|
||||||
|
}
|
||||||
Connecting.Remove( connection );
|
|
||||||
Connected.Remove( connection );
|
|
||||||
|
|
||||||
Interface?.OnDisconnected( connection, info );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Receive( int bufferSize = 32 )
|
public void Receive( int bufferSize = 32 )
|
||||||
|
Loading…
Reference in New Issue
Block a user