Disallow same/similar colors (fixes #2820)
This commit is contained in:
@@ -73,6 +73,30 @@ namespace OpenRA.Server
|
||||
c.Team = pr.Team;
|
||||
}
|
||||
|
||||
static void SendData(Socket s, byte[] data)
|
||||
{
|
||||
var start = 0;
|
||||
var length = data.Length;
|
||||
SocketError error;
|
||||
|
||||
// Non-blocking sends are free to send only part of the data
|
||||
while (start < length)
|
||||
{
|
||||
var sent = s.Send(data, start, length - start, SocketFlags.None, out error);
|
||||
if (error == SocketError.WouldBlock)
|
||||
{
|
||||
Log.Write("server", "Non-blocking send of {0} bytes failed. Falling back to blocking send.", length - start);
|
||||
s.Blocking = true;
|
||||
sent = s.Send(data, start, length - start, SocketFlags.None);
|
||||
s.Blocking = false;
|
||||
}
|
||||
else if (error != SocketError.Success)
|
||||
throw new SocketException((int)error);
|
||||
|
||||
start += sent;
|
||||
}
|
||||
}
|
||||
|
||||
protected volatile ServerState internalState = new ServerState();
|
||||
public ServerState State
|
||||
{
|
||||
@@ -683,29 +707,5 @@ namespace OpenRA.Server
|
||||
gameTimeout.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
static void SendData(Socket s, byte[] data)
|
||||
{
|
||||
var start = 0;
|
||||
var length = data.Length;
|
||||
SocketError error;
|
||||
|
||||
// Non-blocking sends are free to send only part of the data
|
||||
while (start < length)
|
||||
{
|
||||
var sent = s.Send(data, start, length - start, SocketFlags.None, out error);
|
||||
if (error == SocketError.WouldBlock)
|
||||
{
|
||||
Log.Write("server", "Non-blocking send of {0} bytes failed. Falling back to blocking send.", length - start);
|
||||
s.Blocking = true;
|
||||
sent = s.Send(data, start, length - start, SocketFlags.None);
|
||||
s.Blocking = false;
|
||||
}
|
||||
else if (error != SocketError.Success)
|
||||
throw new SocketException((int)error);
|
||||
|
||||
start += sent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user