- Timestamp:
- Jul 24, 2014, 3:25:58 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/AllocsNetTelnetServer.cs
r96 r103 18 18 public static void init (int port) 19 19 { 20 Log.Out ("[7dtd-server-fixes by Alloc] Version: " + Assembly.GetExecutingAssembly ().GetName ().Version); 21 authEnabled = GamePrefs.GetString (EnumGamePrefs.TelnetPassword).Length != 0; 22 if (authEnabled) 23 listener = new TcpListener (IPAddress.Any, port); 24 else 25 listener = new TcpListener (IPAddress.Loopback, port); 26 telnetThread = ThreadMaster.Create ("thread Allocs TelnetListenThread", new ThreadStart (telnetListenThread)); 27 telnetThread.Start (); 28 Log.Out ("Started Allocs NetTelnetServer thread on " + port); 20 try { 21 Log.Out ("[7dtd-server-fixes by Alloc] Version: " + Assembly.GetExecutingAssembly ().GetName ().Version); 22 authEnabled = GamePrefs.GetString (EnumGamePrefs.TelnetPassword).Length != 0; 23 if (authEnabled) 24 listener = new TcpListener (IPAddress.Any, port); 25 else 26 listener = new TcpListener (IPAddress.Loopback, port); 27 telnetThread = ThreadMaster.Create ("thread Allocs TelnetListenThread", new ThreadStart (telnetListenThread)); 28 telnetThread.Start (); 29 Log.Out ("Started Allocs NetTelnetServer thread on " + port); 30 } catch (Exception e) { 31 Log.Out ("Error in AllocsTelnetServer.init: " + e); 32 } 29 33 } 30 34 … … 90 94 { 91 95 c.WriteLine ("*** Connected with 7DTD server."); 92 c.WriteLine ("*** Server version: Alpha 8.7 (b29) Compatibility Version: Alpha 8.7");96 c.WriteLine ("*** Dedicated server only build"); 93 97 c.WriteLine ("*** Allocs server fixes loaded"); 94 98 c.WriteLine (string.Empty); … … 120 124 public static void Disconnect () 121 125 { 122 closed = true; 123 if (listener != null) { 124 listener.Stop (); 126 try { 127 closed = true; 128 if (listener != null) { 129 listener.Stop (); 130 } 131 foreach (AllocsTelnetConnection c in connections) { 132 c.Close (); 133 } 134 Thread.Sleep (100); 135 } catch (Exception e) { 136 Log.Out ("Error in AllocsTelnetServer.Disconnect: " + e); 125 137 } 126 foreach (AllocsTelnetConnection c in connections) {127 c.Close ();128 }129 Thread.Sleep (100);130 138 } 131 139 132 140 public static void SetConsole (ConsoleSdtd console) 133 141 { 134 Log.Out ("Telnet SetConsole called");142 Log.Out ("Telnet SetConsole called"); 135 143 AllocsNetTelnetServer.console = console; 136 144 } … … 138 146 private static void RemoveClosedConnections () 139 147 { 140 foreach (AllocsTelnetConnection c in connections) { 141 if (c.IsClosed ()) { 142 c.Close (); 148 try { 149 foreach (AllocsTelnetConnection c in connections) { 150 if (c.IsClosed ()) { 151 c.Close (); 152 } 143 153 } 154 } catch (Exception e) { 155 Log.Out ("Error in AllocsTelnetServer.RemvoeClosedConnections: " + e); 144 156 } 145 157 }
Note:
See TracChangeset
for help on using the changeset viewer.