Author Topic: Slow Disconnection With RakNet  (Read 871 times)

jmasterx

  • Not-a-newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Slow Disconnection With RakNet
« on: February 09, 2015, 02:39:54 AM »


In my game, I need the client to be able to switch servers very quickly. To do this, the client needs to disconnect from one server and connect to another in a seamless way.

The problem I am having is that, when I send a connection_closed, it can take the server almost 5 seconds before it gets the ID_DISCONNECT_NOTIFICATION. But I notice when I call Shutdown() it gets it immediately. The problem is repeatedly calling shutdown and startup on the client causes bugs and crashes.

What is the correct way to disconnect really fast?

I'm currently simulating a disconnect on the client side, but all the other players still see the player for about 5 seconds when hes now in another server:

Code: [Select]
m_clientInterface->CloseConnection(m_client.getAddress(),false,0,IMMEDIATE_PRIORITY);
        onDisconnect();
        m_connected = false;
        m_connecting = false;

Is it normal that disconnections are so slow? How should I be implementing changing servers? (As in the process of disconnection from one then connecting to the other)

I could always notify the server to destroy the player, but that seems like a hack.

I'm using localhost so the internet is not the issue.

Thanks