File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ public class NativeGameServer
55 private static bool _hadSuccessfulNativeInit = false ;
66 private readonly ushort _listeningPort ;
77 private readonly IntPtr _nativePtr ;
8+ private readonly Native . ConnectionStateChangedCallback _connectionStateChangedCallbackDelegate ;
89
910 public NativeGameServer ( ushort listeningPort )
1011 {
@@ -20,7 +21,9 @@ public NativeGameServer(ushort listeningPort)
2021
2122 _listeningPort = listeningPort ;
2223 _nativePtr = Native . server_create ( listeningPort ) ;
23- Native . server_set_connection_state_changed_cb ( _nativePtr , OnConnectionStateChange ) ;
24+ // TODO: Apparently this is required to prevent the delegate from being GC'ed, so double check and ignore the warnings?
25+ _connectionStateChangedCallbackDelegate = new Native . ConnectionStateChangedCallback ( OnConnectionStateChange ) ;
26+ Native . server_set_connection_state_changed_cb ( _nativePtr , _connectionStateChangedCallbackDelegate ) ;
2427 }
2528
2629 public virtual void Update ( float deltaTime )
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ public class Program
1010 static void Main ( string [ ] args )
1111 {
1212 InitLogging ( ) ;
13- LogManager . GetCurrentClassLogger ( ) . Info ( "Starting Cyberverse Server 0.0.1 (c) 2023 MeFisto94" ) ;
13+ LogManager . GetCurrentClassLogger ( ) . Info ( "Starting Cyberverse Server 0.0.1 (c) 2023-2025 MeFisto94" ) ;
1414 var server = new GameServer ( 1337 ) ;
1515 AddTypicalPacketHandlers ( server ) ;
1616
You can’t perform that action at this time.
0 commit comments