Changeset 183
- Timestamp:
- Sep 9, 2014, 8:12:00 PM (10 years ago)
- Location:
- binary-improvements
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Telnet/Telnet.cs
r182 r183 9 9 public class Telnet : IServer 10 10 { 11 private Thread telnetThread = null;12 11 private TcpListener listener = null; 13 private bool closed = false;14 12 private bool authEnabled = false; 15 13 private List<TelnetConnection> connections = new List<TelnetConnection> (); … … 29 27 else 30 28 listener = new TcpListener (IPAddress.Loopback, port); 31 telnetThread = ThreadMaster.Create ("thread TelnetListenThread", new ThreadStart (telnetListenThread)); 32 telnetThread.Start (); 29 30 listener.Start (); 31 listener.BeginAcceptTcpClient (new AsyncCallback (AcceptClient), null); 33 32 34 33 NetTelnetServer.RegisterServer (this); … … 40 39 } 41 40 42 private void telnetListenThread ()41 private void AcceptClient (IAsyncResult asyncResult) 43 42 { 44 try { 45 listener.Start (); 46 try { 47 while (!closed) { 48 TelnetConnection c = new TelnetConnection (listener.AcceptTcpClient (), authEnabled); 49 connections.Add (c); 50 } 51 } catch (SocketException) { 52 } catch (ThreadInterruptedException) { 53 } 54 ThreadMaster.Remove (Thread.CurrentThread.Name); 55 } catch (Exception ex) { 56 Log.Out ("Error in TelnetListenThread: " + ex); 43 if (listener.Server.IsBound) { 44 TelnetConnection c = new TelnetConnection (listener.EndAcceptTcpClient (asyncResult), authEnabled); 45 connections.Add (c); 46 listener.BeginAcceptTcpClient (new AsyncCallback (AcceptClient), null); 57 47 } 58 48 } … … 61 51 { 62 52 try { 63 closed = true;64 53 if (listener != null) { 65 54 listener.Stop (); … … 68 57 foreach (TelnetConnection c in connections) { 69 58 c.Close (); 70 }71 Thread.Sleep (100);72 if (telnetThread != null) {73 telnetThread.Interrupt ();74 59 } 75 60 } catch (Exception e) { -
binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Telnet/TelnetConnection.cs
r182 r183 93 93 } 94 94 } 95 } catch (ObjectDisposedException) { 95 96 } catch (IOException) { 96 97 } catch (ThreadInterruptedException) { -
binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Web/Web.cs
r182 r183 29 29 } 30 30 31 if (!HttpListener.IsSupported) 32 throw new NotSupportedException ("Needs Windows XP SP2, Server 2003 or later."); 31 if (!HttpListener.IsSupported) { 32 Log.Out ("Webserver not started (needs Windows XP SP2, Server 2003 or later or Mono)"); 33 return; 34 } 33 35 34 36 handlers.Add ("/index.htm", new SimpleRedirectHandler ("/static/index.html")); -
binary-improvements/bin/Release/7dtd-server-fixes_version.txt
r182 r183 1 Version: 0.9 2.5365.357781 Version: 0.93.5365.36355
Note:
See TracChangeset
for help on using the changeset viewer.