Simplify conditionals

This commit is contained in:
Paul Pacheco 2018-10-11 19:43:20 -05:00
parent 9a542e98cc
commit e2577ef785

View File

@ -52,7 +52,7 @@ public void ClientDisconnect()
// server
public bool ServerActive()
{
return server != null ? server.ServerActive() : false;
return server != null && server.ServerActive();
}
public void ServerStart(string address, int port, int maxConnections)
@ -83,7 +83,7 @@ public void ServerStartWebsockets(string address, int port, int maxConnections)
public bool ServerSend(int connectionId, byte[] data)
{
return server != null ? server.ServerSend(connectionId, data) : false;
return server != null && server.ServerSend(connectionId, data);
}
public bool ServerGetNextMessage(out int connectionId, out TransportEvent transportEvent, out byte[] data)
@ -91,18 +91,18 @@ public bool ServerGetNextMessage(out int connectionId, out TransportEvent transp
connectionId = -1;
transportEvent = TransportEvent.Disconnected;
data = null;
return server != null ? server.ServerGetNextMessage(out connectionId, out transportEvent, out data) : false;
return server != null && server.ServerGetNextMessage(out connectionId, out transportEvent, out data);
}
public bool ServerDisconnect(int connectionId)
{
return server != null ? server.ServerDisconnect(connectionId) : false;
return server != null && server.ServerDisconnect(connectionId);
}
public bool GetConnectionInfo(int connectionId, out string address)
{
address = null;
return server != null ? server.GetConnectionInfo(connectionId, out address) : false;
return server != null && server.GetConnectionInfo(connectionId, out address);
}
public void ServerStop()