- Timestamp:
- Sep 12, 2014, 11:14:11 AM (10 years ago)
- Location:
- binary-improvements/7dtd-server-fixes/src/NetConnections/Servers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Telnet/TelnetConnection.cs
r187 r189 38 38 39 39 if (endpoint is IPEndPoint) { 40 endpointAddressHash = ((IPEndPoint)endpoint).Address.GetHashCode ();40 endpointAddressHash = ((IPEndPoint)endpoint).Address.GetHashCode (); 41 41 //Log.Out ("Hash: " + endpointAddressHash); 42 42 } else { 43 Log.Out ("EndPoint is not an IPEndPoint but: " + endpoint.GetType ().ToString());43 Log.Out ("EndPoint is not an IPEndPoint but: " + endpoint.GetType ().ToString ()); 44 44 } 45 45 … … 78 78 while (!IsClosed()) { 79 79 string line = reader.ReadLine (); 80 if (line != null ) {80 if (line != null && line.Length > 0) { 81 81 line = line.Trim (); 82 83 if (!IsAuthenticated ()) { 84 if (line.Equals (GamePrefs.GetString (EnumGamePrefs.TelnetPassword))) { 85 authenticated = true; 86 WriteLine ("Logon successful."); 87 WriteLine (string.Empty); 88 WriteLine (string.Empty); 89 WriteLine (string.Empty); 90 LoginMessage (); 82 if (line.Length > 0) { 83 if (!IsAuthenticated ()) { 84 if (line.Equals (GamePrefs.GetString (EnumGamePrefs.TelnetPassword))) { 85 authenticated = true; 86 WriteLine ("Logon successful."); 87 WriteLine (string.Empty); 88 WriteLine (string.Empty); 89 WriteLine (string.Empty); 90 LoginMessage (); 91 } else { 92 if (owner.RegisterFailedLogin (endpointAddressHash)) { 93 WriteLine ("Password incorrect, please enter password:"); 94 } else { 95 WriteLine ("Too many failed login attempts!"); 96 Thread.Sleep (100); 97 Close (); 98 Log.Out ("Telnet connection closed for too many login attempts: " + endpoint); 99 break; 100 } 101 } 91 102 } else { 92 if (owner.RegisterFailedLogin(endpointAddressHash)) { 93 WriteLine ("Password incorrect, please enter password:"); 94 } else { 95 WriteLine ("Too many failed login attempts!"); 96 Thread.Sleep(100); 103 if (line.ToLower ().Equals ("exit")) { 104 Log.Out ("Telnet connection closed by client: " + endpoint); 97 105 Close (); 98 Log.Out ("Telnet connection closed for too many login attempts: " + endpoint);99 106 break; 100 107 } 108 Log.Out ("Telnet executed \"" + line + "\" from: " + endpoint); 109 ConsoleOutputSeparator.QueueNetCommand (line, this); 101 110 } 102 } else {103 if (line.ToLower ().Equals ("exit")) {104 Log.Out ("Telnet connection closed by client: " + endpoint);105 Close ();106 break;107 }108 Log.Out ("Telnet executed \"" + line + "\" from: " + endpoint);109 ConsoleOutputSeparator.QueueNetCommand (line, this);110 111 } 111 112 } -
binary-improvements/7dtd-server-fixes/src/NetConnections/Servers/Web/StaticHandler.cs
r154 r189 30 30 byte[] content; 31 31 if (cache) { 32 Monitor.Enter (fileCache); 33 try { 32 lock (fileCache) { 34 33 if (!fileCache.ContainsKey (fn)) { 35 34 if (!File.Exists (datapath + "/" + fn)) { … … 41 40 42 41 content = fileCache [fn]; 43 } finally {44 Monitor.Exit (fileCache);45 42 } 46 43 } else { … … 55 52 resp.ContentLength64 = content.Length; 56 53 resp.OutputStream.Write (content, 0, content.Length); 57 } catch (FileNotFoundException e) {54 } catch (FileNotFoundException) { 58 55 resp.StatusCode = (int)HttpStatusCode.NotFound; 59 56 if (logMissingFiles)
Note:
See TracChangeset
for help on using the changeset viewer.