private void InitializeServerBackend() { if (Server == null) { Debug.LogWarning("Ignorance Server: Reference for Server mode was null. This shouldn't happen, but to be safe we'll attempt to reinitialize it."); Server = new IgnoranceServer(); } // Set up the new IgnoranceServer reference. if (serverBindsAll) { // MacOS is special. It's also a massive thorn in my backside. Server.BindAddress = IgnoranceInternals.BindAnyAddress; } else { // Use the supplied bind address. Server.BindAddress = serverBindAddress; } // Sets port, maximum peers, max channels, the server poll time, maximum packet size and verbosity. Server.BindPort = port; Server.MaximumPeers = serverMaxPeerCapacity; Server.MaximumChannels = Channels.Length; Server.PollTime = serverMaxNativeWaitTime; Server.MaximumPacketSize = MaxAllowedPacketSize; Server.Verbosity = (int)LogType; Server.IncomingOutgoingBufferSize = ServerDataBufferSize; Server.ConnectionEventBufferSize = ServerConnEventBufferSize; // Initializes the packet buffer. // Allocates once, that's it. if (InternalPacketBuffer == null) { InternalPacketBuffer = new byte[PacketBufferCapacity]; } // This is required to ensure that ServerStatistics peer stats are initialised before first update if (ServerStatistics.PeerStats == null) { ServerStatistics.PeerStats = new Dictionary <int, IgnoranceClientStats>(serverMaxPeerCapacity); } // Setup the peer connection array. peerConnectionData = new PeerConnectionData[serverMaxPeerCapacity]; }
private void InitializeServerBackend() { if (Server == null) { Debug.LogWarning("IgnoranceServer reference for Server mode was null. This shouldn't happen, but to be safe we'll reinitialize it."); Server = new IgnoranceServer(); } // Set up the new IgnoranceServer reference. if (serverBindsAll) { // MacOS is special. It's also a massive thorn in my backside. Server.BindAddress = IgnoranceInternals.BindAllMacs; } else { // Use the supplied bind address. Server.BindAddress = serverBindAddress; } // Sets port, maximum peers, max channels, the server poll time, maximum packet size and verbosity. Server.BindPort = port; Server.MaximumPeers = serverMaxPeerCapacity; Server.MaximumChannels = Channels.Length; Server.PollTime = serverMaxNativeWaitTime; Server.MaximumPacketSize = MaxAllowedPacketSize; Server.Verbosity = (int)LogType; // Initializes the packet buffer. // Allocates once, that's it. if (InternalPacketBuffer == null) { InternalPacketBuffer = new byte[PacketBufferCapacity]; } // Setup the peer connection array. peerConnectionData = new PeerConnectionData[420]; }