server debug-prints
This commit is contained in:
@@ -73,9 +73,6 @@ namespace OpenRA.Server
|
|||||||
|
|
||||||
case ReceiveState.Data:
|
case ReceiveState.Data:
|
||||||
{
|
{
|
||||||
// if (bytes.Length > 0)
|
|
||||||
// Console.WriteLine("{0} bytes", bytes.Length);
|
|
||||||
|
|
||||||
Server.DispatchOrders(this, Frame, bytes);
|
Server.DispatchOrders(this, Frame, bytes);
|
||||||
ExpectLength = 8;
|
ExpectLength = 8;
|
||||||
State = ReceiveState.Header;
|
State = ReceiveState.Header;
|
||||||
|
|||||||
27
OpenRA.Server/Exts.cs
Executable file
27
OpenRA.Server/Exts.cs
Executable file
@@ -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<T> Except<T>( this IEnumerable<T> ts, T t )
|
||||||
|
{
|
||||||
|
return ts.Except( new[] { t } );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -49,6 +49,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Connection.cs" />
|
<Compile Include="Connection.cs" />
|
||||||
|
<Compile Include="Exts.cs" />
|
||||||
<Compile Include="Server.cs" />
|
<Compile Include="Server.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ServerOrder.cs" />
|
<Compile Include="ServerOrder.cs" />
|
||||||
|
|||||||
@@ -91,8 +91,8 @@ namespace OpenRA.Server
|
|||||||
State = Session.ClientState.NotReady
|
State = Session.ClientState.NotReady
|
||||||
});
|
});
|
||||||
|
|
||||||
Console.WriteLine("Accepted connection from {0}.",
|
Console.WriteLine("Client {0}: Accepted connection from {1}",
|
||||||
newConn.socket.RemoteEndPoint);
|
newConn.PlayerIndex, newConn.socket.RemoteEndPoint);
|
||||||
|
|
||||||
SendChat(newConn, "has joined the game.");
|
SendChat(newConn, "has joined the game.");
|
||||||
|
|
||||||
@@ -343,6 +343,7 @@ namespace OpenRA.Server
|
|||||||
if (!dict.TryGetValue(cmdName, out a))
|
if (!dict.TryGetValue(cmdName, out a))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
Console.WriteLine( "Client {0} sent server command: {1}", conn.PlayerIndex, cmd );
|
||||||
return a(cmdValue);
|
return a(cmdValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,7 +435,6 @@ namespace OpenRA.Server
|
|||||||
public static void DropClient(Connection toDrop, Exception e)
|
public static void DropClient(Connection toDrop, Exception e)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Client dropped: {0}.", toDrop.socket.RemoteEndPoint);
|
Console.WriteLine("Client dropped: {0}.", toDrop.socket.RemoteEndPoint);
|
||||||
//Console.WriteLine(e.ToString());
|
|
||||||
|
|
||||||
conns.Remove(toDrop);
|
conns.Remove(toDrop);
|
||||||
SendChat(toDrop, "Connection Dropped");
|
SendChat(toDrop, "Connection Dropped");
|
||||||
@@ -454,13 +454,6 @@ namespace OpenRA.Server
|
|||||||
else SyncLobbyInfo();
|
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<T> Except<T>(this IEnumerable<T> ts, T t)
|
|
||||||
{
|
|
||||||
return ts.Except(new[] { t });
|
|
||||||
}
|
|
||||||
|
|
||||||
static void OnServerEmpty()
|
static void OnServerEmpty()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Server emptied out; doing a bit of housekeeping to prepare for next game..");
|
Console.WriteLine("Server emptied out; doing a bit of housekeeping to prepare for next game..");
|
||||||
|
|||||||
Reference in New Issue
Block a user