Photon not disconnecting if we disconnect internet while connected

Hi,

We are facing this issue with PUN. While game is running and if we disconnect internet, we don't get disconnect callbacks and game keeps running.

PUN + 1.73
Unity 5.4.2p2

Steps to reproduce
1. Connect your device or machine to a wifi
2. Once inside room, remove internet cable from your router or if you are using android device just pull down setting and switch off wifi.

Notice that app doesn't get disconnected. We have set background time out and app disconnect time out to 10seconds.

Thanks

Comments

  • avinash
    avinash
    edited November 2016
    I have implemented a work around for this. I check LastSendAckTime of NetworkingPeer. If the difference is more than 15s then we disconnect
    
    if(PhotonNetwork.connected) {
     if(m_LastPhotonACKTime != PhotonNetwork.networkingPeer.LastSendAckTime) {
          m_LastPhotonACKTime = PhotonNetwork.networkingPeer.LastSendAckTime;
          m_LastPhotonACKTimeReceived = PhotonNetwork.time;
       }
       else if(0d != m_LastPhotonACKTimeReceived && PhotonNetwork.time - m_LastPhotonACKTimeReceived > 15)
      {
          PhotonNetwork.Disconnect();
       }
    }
    
  • @avinash I think PlayerTTL (Time to live) of RoomOptions when you create room, you need set PlayerTTL = 0
  • Hi,

    very cool trick with LastSendAckTime, totally going to use that!

    Bye,

    Jean
  • avinash said:

    I have implemented a work around for this. I check LastSendAckTime of NetworkingPeer. If the difference is more than 15s then we disconnect

    
    if(PhotonNetwork.connected) {
     if(m_LastPhotonACKTime != PhotonNetwork.networkingPeer.LastSendAckTime) {
          m_LastPhotonACKTime = PhotonNetwork.networkingPeer.LastSendAckTime;
          m_LastPhotonACKTimeReceived = PhotonNetwork.time;
       }
       else if(0d != m_LastPhotonACKTimeReceived && PhotonNetwork.time - m_LastPhotonACKTimeReceived > 15)
      {
          PhotonNetwork.Disconnect();
       }
    }
    
    Hi, what is your
    m_LastPhotonACKTime
    m_LastPhotonACKTimeReceived
    0d

    Are they variables?

  • Hi, what is your
    m_LastPhotonACKTime
    m_LastPhotonACKTimeReceived
    0d

    Are they variables?

    Yes, These are local variable. used in this code only.

    private int m_LastPhotonACKTime = 0; private double m_LastPhotonACKTimeReceived = 0d;