@@ -38,18 +38,13 @@ public void SendRawSteam(byte[] raw, bool reliable)
3838 ServerLog . Error ( $ "Failed to send packet (len: { raw . Length } ): { hex } ") ;
3939 }
4040
41- public override void Close ( MpDisconnectReason reason , byte [ ] data = null )
42- {
43- if ( State != ConnectionStateEnum . ClientSteam )
44- Send ( Packets . Special_Steam_Disconnect , GetDisconnectBytes ( reason , data ) ) ;
45- }
46-
4741 public abstract void OnError ( EP2PSessionError error ) ;
4842
49- public override string ToString ( )
43+ protected override void OnClose ( )
5044 {
51- return $ "SteamP2P ({ remoteId } :{ username } )";
5245 }
46+
47+ public override string ToString ( ) => $ "SteamP2P ({ remoteId } :{ username } )";
5348 }
5449
5550 public class SteamClientConn ( CSteamID remoteId ) : SteamBaseConn ( remoteId , RandomChannelId ( ) , 0 ) , ITickableConnection
@@ -66,30 +61,12 @@ public void Tick()
6661 }
6762 }
6863
69- protected override void HandleReceiveMsg ( int msgId , int fragState , ByteReader reader , bool reliable )
70- {
71- if ( msgId == ( int ) Packets . Special_Steam_Disconnect )
72- {
73- var info = SessionDisconnectInfo . From ( reader . ReadEnum < MpDisconnectReason > ( ) , reader ) ;
74- OnDisconnect ( info ) ;
75- return ;
76- }
77-
78- base . HandleReceiveMsg ( msgId , fragState , reader , reliable ) ;
79- }
80-
8164 public override void OnError ( EP2PSessionError error )
8265 {
8366 var title = error == EP2PSessionError . k_EP2PSessionErrorTimeout
8467 ? "MpSteamTimedOut" . Translate ( )
8568 : "MpSteamGenericError" . Translate ( ) ;
86-
87- OnDisconnect ( new SessionDisconnectInfo { titleTranslated = title } ) ;
88- }
89-
90- private void OnDisconnect ( SessionDisconnectInfo info )
91- {
92- ConnectionStatusListeners . TryNotifyAll_Disconnected ( info ) ;
69+ ConnectionStatusListeners . TryNotifyAll_Disconnected ( new SessionDisconnectInfo { titleTranslated = title } ) ;
9370 Multiplayer . StopMultiplayer ( ) ;
9471 }
9572 }
@@ -104,17 +81,6 @@ public override void Send(Packets id, byte[] message, bool reliable = true)
10481 base . Send ( id , message , reliable ) ;
10582 }
10683
107- protected override void HandleReceiveMsg ( int msgId , int fragState , ByteReader reader , bool reliable )
108- {
109- if ( msgId == ( int ) Packets . Special_Steam_Disconnect )
110- {
111- OnDisconnect ( ) ;
112- return ;
113- }
114-
115- base . HandleReceiveMsg ( msgId , fragState , reader , reliable ) ;
116- }
117-
11884 public override void OnError ( EP2PSessionError error )
11985 {
12086 OnDisconnect ( ) ;
0 commit comments