Author Topic: Servers lingering in server list  (Read 5341 times)

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
Servers lingering in server list
« on: August 01, 2016, 02:55:46 PM »
I have a list of servers populated on a button press. At the beginning of the scene (main menu) I stop servers in the Start call. However, when I then press the server search button, the terminated server is still present and will remain until a few seconds after termination.
  1.         void Start () {
  2.                 if(TNManager.isInChannel){
  3.                         TNManager.LeaveAllChannels();
  4.                 }
  5.                 if(TNServerInstance.isActive){
  6.                         TNServerInstance.Stop ();
  7.                 }
  8.                 ...
  9.         }
  10.  
  11.         public void UpdateServerList(){
  12.                 // populate with available servers and show when button pressed
  13.                 serverList = TNLobbyClient.knownServers.list;
  14.                 while (serverGrid.transform.childCount > 0){
  15.                         NGUITools.Destroy(serverGrid.transform.GetChild(0).gameObject);
  16.                 }
  17.  
  18.                 if(serverList.Count == 0){
  19.                         twn_noGamesFound.PlayForward ();       
  20.                 }else{
  21.                         for(int n = 0; n < serverList.Count; n++){
  22.                                 ServerList.Entry ent = serverList[n];
  23.                                 go = NGUITools.AddChild (serverGrid.gameObject, serverEntryPrefab);
  24.                                 go.transform.GetChild (0).GetComponent<UILabel>().text = ent.name;
  25.                                 go.name = ""+n;
  26.                                 go.GetComponent<UIDragScrollView>().scrollView = go.transform.parent.GetComponent<UIScrollView>();
  27.                         }
  28.  
  29.                         serverGrid.transform.parent.GetComponent<UIScrollView>().ResetPosition ();
  30.                         serverGrid.Reposition ();
  31.                         serverGrid.transform.parent.GetComponent<UIScrollView>().ResetPosition ();
  32.                         twn_noGamesFound.PlayReverse ();       
  33.                 }
  34.         }

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Servers lingering in server list
« Reply #1 on: August 01, 2016, 03:01:01 PM »
Assuming you're using a UDP server lobby link, it's the expected behaviour. UDP updates are periodic and don't have an established connection that has a way to identify when it was closed.