private bool TryRegisterServer(IPAddress who_requests, DiceGameServerEntry new_server) { if (IsRecentIp(who_requests) || !DbServer.InsertDiceGameServer(new_server)) { return(false); } _recent_server_creators_IPs.Enqueue(new TimestampedIP(who_requests, DateTime.UtcNow)); OnMessageToGameServer?.Invoke( this, new MessageToGameServerEventArgs(new_server, HeadToGameServerMessage.AckRegister) ); return(true); }
public bool TryRegisterServer(IPAddress who_requests, GameServerEntry server_options) { if (IsRecentIp(who_requests)) { return(false); } int insert_result = server_options.ExecuteInsertCommand(DbServer.Connection); if (insert_result != 0) { return(false); } _recent_server_creators_IPs.Enqueue(new TimestampedIP(who_requests, DateTime.UtcNow)); OnMessageToGameServer?.Invoke( this, new MessageToGameServerEventArgs(server_options, HeadToGameServerMessage.AckRegister) ); return(true); }