Question about behavior of PhotonPeer after failure to connect to server

If I attempt to connect an ExitGames.Client.Photon.PhotonPeer to an unhosted local port (nothing is listening on this port), then eventually the DebugReturn method of the IPhotonPeerListener implentation is invoked saying the connection was actively refused, which is what I expect.

However, when I try to reconnect, photon says the peer is already in a connected state, and the connect request will be ignored.

It seems like the only way to detect this case is to catch the ERROR debug level in DebugReturn, and manually call disconnect on the peer. This seems really clunky, so maybe I'm missing something obvious.

Is there a better way to deal with this scenario?

Comments

  • there is OnStatusChanged callback in IPhotonListener. you may see how status changes there. and when peer is in Disconnected state, you may call Connect again
  • Yeah, that would be great if it worked. Unfortunately, in the scenario I detailed above, OnStatusChanged is NOT called, but the internal state of the peer is set to connected.
  • Ok, I see the issue, it looks like PeerBase.Service was not getting called after a certain point, which was what was preventing the status changed callback from getting dispatched.