public bool RemoveServer(ServerListing serverListing) { int serverIndex = _servers.FindIndex(x => x.IP == serverListing.IP && x.Port == serverListing.Port); if (serverIndex != -1) { _servers.RemoveAt(serverIndex); _logger.LogInformation($"Server {serverListing.Name} {serverListing.IP}:{serverListing.Port} removed"); return(true); } return(false); }
private void Awake() { //connectionConfig.MaxSentMessageQueueSize = 2048; //connectionConfig.MaxCombinedReliableMessageCount = 20; //Debug.Log("It's Alive! (ArsNetworkManager.cs)"); useWebSockets = true; ServerListing = ServerListing.FromWebJSON( "https://docs.google.com/document/d/1LLT3FxiRC-NoI6OnRHlMUSd5O1_I4zB-ABDR4-wCNp0/export?format=txt"); Debug.Log("Server Count: " + ServerListing.Servers.Length); }
public IActionResult RegisterServer([FromBody] ServerListing serverListing) { if (string.IsNullOrEmpty(serverListing.Name)) { return(BadRequest("Invaild server details")); } serverListing.IP = Request.HttpContext.Connection.RemoteIpAddress.ToString(); _masterServerListService.AddServer(serverListing); return(Ok()); }
public static void PopulateList() { for (int i = 0; i < List.Count / 4; i++) { ServerListing listing = new ServerListing(); listing.lServerAddress.Text = $"{List[i].ip}:{List[i].port}"; listing.lServerLatency.Text = $"{ServerLatency(List[i].ip)}ms"; listing.Width = windowMain.pServerList.Width - 25; if (listing.lServerLatency.Text != "--ms") { windowMain.pServerList.Controls.Add(listing); } } }
public void AddServer(ServerListing serverListing) { serverListing.LastUpdate = DateTime.Now; int existingListingIndex = _servers.FindIndex(x => x.IP == serverListing.IP && x.Port == serverListing.Port); if (existingListingIndex == -1) { _servers.Add(serverListing); _logger.LogInformation($"New server registered {serverListing.Name} {serverListing.IP}:{serverListing.Port}"); } else { _servers[existingListingIndex] = serverListing; _logger.LogInformation($"Server updated {serverListing.Name} {serverListing.IP}:{serverListing.Port}"); } }
public IActionResult UnregisterServer([FromBody] ServerListing serverListing) { serverListing.IP = Request.HttpContext.Connection.RemoteIpAddress.ToString(); return(_masterServerListService.RemoveServer(serverListing) ? Ok("Removed the server.") : BadRequest("Failed to remove the server")); }