66using Steamworks . Data ;
77using System ;
88using System . Collections . Generic ;
9+ using FishNet . Managing ;
910using UnityEngine ;
1011
1112namespace FishyFacepunch . Server
@@ -167,8 +168,7 @@ internal bool StopConnection(int connectionId)
167168 }
168169 else
169170 {
170- if ( base . Transport . NetworkManager . CanLog ( LoggingType . Error ) )
171- Debug . LogError ( $ "Steam connection not found for connectionId { connectionId } .") ;
171+ Transport . NetworkManager . LogError ( $ "Steam connection not found for connectionId { connectionId } .") ;
172172 return false ;
173173 }
174174 }
@@ -183,8 +183,7 @@ private bool StopConnection(int connectionId, Connection socket)
183183 socket . Close ( false , 0 , "Graceful disconnect" ) ;
184184 _steamConnections . Remove ( connectionId ) ;
185185 _steamIds . Remove ( connectionId ) ;
186- if ( base . Transport . NetworkManager . CanLog ( LoggingType . Common ) )
187- Debug . Log ( $ "Client with ConnectionID { connectionId } disconnected.") ;
186+ Transport . NetworkManager . Log ( $ "Client with ConnectionID { connectionId } disconnected.") ;
188187 base . Transport . HandleRemoteConnectionState ( new RemoteConnectionStateArgs ( RemoteConnectionState . Stopped , connectionId , Transport . Index ) ) ;
189188 _cachedConnectionIds . Enqueue ( connectionId ) ;
190189
@@ -201,8 +200,7 @@ private void OnRemoteConnectionState(Connection conn, ConnectionInfo info)
201200 {
202201 if ( _steamConnections . Count >= _maximumClients )
203202 {
204- if ( base . Transport . NetworkManager . CanLog ( LoggingType . Common ) )
205- Debug . Log ( $ "Incoming connection { clientSteamID } was rejected because would exceed the maximum connection count.") ;
203+ Transport . NetworkManager . Log ( $ "Incoming connection { clientSteamID } was rejected because would exceed the maximum connection count.") ;
206204
207205 conn . Close ( false , 0 , "Max Connection Count" ) ;
208206 return ;
@@ -212,13 +210,11 @@ private void OnRemoteConnectionState(Connection conn, ConnectionInfo info)
212210
213211 if ( ( res = conn . Accept ( ) ) == Result . OK )
214212 {
215- if ( base . Transport . NetworkManager . CanLog ( LoggingType . Common ) )
216- Debug . Log ( $ "Accepting connection { clientSteamID } ") ;
213+ Transport . NetworkManager . Log ( $ "Accepting connection { clientSteamID } ") ;
217214 }
218215 else
219216 {
220- if ( base . Transport . NetworkManager . CanLog ( LoggingType . Common ) )
221- Debug . Log ( $ "Connection { clientSteamID } could not be accepted: { res . ToString ( ) } ") ;
217+ Transport . NetworkManager . Log ( $ "Connection { clientSteamID } could not be accepted: { res . ToString ( ) } ") ;
222218 }
223219 }
224220 else if ( info . State == ConnectionState . Connected )
@@ -227,8 +223,7 @@ private void OnRemoteConnectionState(Connection conn, ConnectionInfo info)
227223 _steamConnections . Add ( conn , connectionId ) ;
228224 _steamIds . Add ( clientSteamID , connectionId ) ;
229225
230- if ( base . Transport . NetworkManager . CanLog ( LoggingType . Common ) )
231- Debug . Log ( $ "Client with SteamID { clientSteamID } connected. Assigning connection id { connectionId } ") ;
226+ Transport . NetworkManager . Log ( $ "Client with SteamID { clientSteamID } connected. Assigning connection id { connectionId } ") ;
232227 base . Transport . HandleRemoteConnectionState ( new RemoteConnectionStateArgs ( RemoteConnectionState . Started , connectionId , Transport . Index ) ) ;
233228 }
234229 else if ( info . State == ConnectionState . ClosedByPeer || info . State == ConnectionState . ProblemDetectedLocally )
@@ -240,8 +235,7 @@ private void OnRemoteConnectionState(Connection conn, ConnectionInfo info)
240235 }
241236 else
242237 {
243- if ( base . Transport . NetworkManager . CanLog ( LoggingType . Common ) )
244- Debug . Log ( $ "Connection { clientSteamID } state changed: { info . State . ToString ( ) } ") ;
238+ Transport . NetworkManager . Log ( $ "Connection { clientSteamID } state changed: { info . State . ToString ( ) } ") ;
245239 }
246240 }
247241
@@ -316,20 +310,17 @@ internal void SendToClient(byte channelId, ArraySegment<byte> segment, int conne
316310
317311 if ( res == Result . NoConnection || res == Result . InvalidParam )
318312 {
319- if ( base . Transport . NetworkManager . CanLog ( LoggingType . Common ) )
320- Debug . Log ( $ "Connection to { connectionId } was lost.") ;
313+ Transport . NetworkManager . Log ( $ "Connection to { connectionId } was lost.") ;
321314 StopConnection ( connectionId , steamConn ) ;
322315 }
323316 else if ( res != Result . OK )
324317 {
325- if ( base . Transport . NetworkManager . CanLog ( LoggingType . Error ) )
326- Debug . LogError ( $ "Could not send: { res . ToString ( ) } ") ;
318+ Transport . NetworkManager . LogError ( $ "Could not send: { res . ToString ( ) } ") ;
327319 }
328320 }
329321 else
330322 {
331- if ( base . Transport . NetworkManager . CanLog ( LoggingType . Error ) )
332- Debug . LogError ( $ "ConnectionId { connectionId } does not exist, data will not be sent.") ;
323+ Transport . NetworkManager . LogError ( $ "ConnectionId { connectionId } does not exist, data will not be sent.") ;
333324 }
334325 }
335326
@@ -346,8 +337,7 @@ internal string GetConnectionAddress(int connectionId)
346337 }
347338 else
348339 {
349- if ( base . Transport . NetworkManager . CanLog ( LoggingType . Error ) )
350- Debug . LogError ( $ "ConnectionId { connectionId } is invalid; address cannot be returned.") ;
340+ Transport . NetworkManager . LogError ( $ "ConnectionId { connectionId } is invalid; address cannot be returned.") ;
351341
352342 return string . Empty ;
353343 }
0 commit comments