Changeset 189 for binary-improvements/7dtd-server-fixes/src/NetConnections
- Timestamp:
- Sep 12, 2014, 11:14:11 AM (10 years ago)
- Location:
- binary-improvements/7dtd-server-fixes/src/NetConnections
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
binary-improvements/7dtd-server-fixes/src/NetConnections/ConsoleOutputSeparator.cs
r132 r189 28 28 Log.Out ("Executed command \"" + _command + "\" from player \"" + _playerID + "\""); 29 29 30 object obj = netCommandQueue; 31 Monitor.Enter (obj); 32 try { 30 lock (netCommandQueue) { 33 31 isCurrentCommandFromClient = true; 34 32 console.issuerOfCurrentClientCommand = _networkPlayer; 35 33 console.ExecuteClientCmdInternal (_playerID, _command); 36 34 isCurrentCommandFromClient = false; 37 } finally {38 Monitor.Exit (obj);39 35 } 40 36 … … 61 57 { 62 58 if (netCommandQueue.Count > 0) { 63 object obj = netCommandQueue; 64 Monitor.Enter (obj); 65 try { 59 lock (netCommandQueue) { 66 60 issuerOfCurrentCommand = netCommandQueue [0].client; 67 console.ExecuteRemoteCmdInternal (netCommandQueue [0].command, false); 61 try { 62 console.ExecuteRemoteCmdInternal (netCommandQueue [0].command, false); 63 } catch (Exception e) { 64 Log.Out("Exception while executing command: " + e); 65 } 68 66 netCommandQueue.RemoveAt (0); 69 67 issuerOfCurrentCommand = null; 70 } finally {71 Monitor.Exit (obj);72 68 } 73 69 } … … 76 72 public static void QueueNetCommand (string _line, IConnection _con) 77 73 { 78 object obj = netCommandQueue; 79 Monitor.Enter (obj); 80 try { 74 lock (netCommandQueue) { 81 75 netCommandQueue.Add (new NetCommand (_line, _con)); 82 } finally {83 Monitor.Exit (obj);84 76 } 85 77 } -
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.