diff --git a/OpenRA.Server/Connection.cs b/OpenRA.Server/Connection.cs index bbf82730e3..aee669dd10 100644 --- a/OpenRA.Server/Connection.cs +++ b/OpenRA.Server/Connection.cs @@ -73,9 +73,6 @@ namespace OpenRA.Server case ReceiveState.Data: { - // if (bytes.Length > 0) - // Console.WriteLine("{0} bytes", bytes.Length); - Server.DispatchOrders(this, Frame, bytes); ExpectLength = 8; State = ReceiveState.Header; diff --git a/OpenRA.Server/Exts.cs b/OpenRA.Server/Exts.cs new file mode 100755 index 0000000000..91ac680123 --- /dev/null +++ b/OpenRA.Server/Exts.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.IO; + +namespace OpenRA.Server +{ + static class Exts + { + public static void Write( this Stream s, byte[] data ) + { + s.Write( data, 0, data.Length ); + } + + public static byte[] Read( this Stream s, int len ) + { + var data = new byte[ len ]; + s.Read( data, 0, len ); + return data; + } + + public static IEnumerable Except( this IEnumerable ts, T t ) + { + return ts.Except( new[] { t } ); + } + } +} diff --git a/OpenRA.Server/OpenRA.Server.csproj b/OpenRA.Server/OpenRA.Server.csproj index 58d23e8a2f..a69c7eab65 100644 --- a/OpenRA.Server/OpenRA.Server.csproj +++ b/OpenRA.Server/OpenRA.Server.csproj @@ -49,6 +49,7 @@ + diff --git a/OpenRA.Server/Server.cs b/OpenRA.Server/Server.cs index d716242191..ba9143262f 100644 --- a/OpenRA.Server/Server.cs +++ b/OpenRA.Server/Server.cs @@ -91,8 +91,8 @@ namespace OpenRA.Server State = Session.ClientState.NotReady }); - Console.WriteLine("Accepted connection from {0}.", - newConn.socket.RemoteEndPoint); + Console.WriteLine("Client {0}: Accepted connection from {1}", + newConn.PlayerIndex, newConn.socket.RemoteEndPoint); SendChat(newConn, "has joined the game."); @@ -343,6 +343,7 @@ namespace OpenRA.Server if (!dict.TryGetValue(cmdName, out a)) return false; + Console.WriteLine( "Client {0} sent server command: {1}", conn.PlayerIndex, cmd ); return a(cmdValue); } @@ -434,7 +435,6 @@ namespace OpenRA.Server public static void DropClient(Connection toDrop, Exception e) { Console.WriteLine("Client dropped: {0}.", toDrop.socket.RemoteEndPoint); - //Console.WriteLine(e.ToString()); conns.Remove(toDrop); SendChat(toDrop, "Connection Dropped"); @@ -454,13 +454,6 @@ namespace OpenRA.Server else SyncLobbyInfo(); } - public static void Write(this Stream s, byte[] data) { s.Write(data, 0, data.Length); } - public static byte[] Read(this Stream s, int len) { var data = new byte[len]; s.Read(data, 0, len); return data; } - public static IEnumerable Except(this IEnumerable ts, T t) - { - return ts.Except(new[] { t }); - } - static void OnServerEmpty() { Console.WriteLine("Server emptied out; doing a bit of housekeeping to prepare for next game..");