stateUpdate not called when disconnected

liortal53
liortal53
edited November 2013 in Native
Hi,

When testing disconnection scenarios (Android game, built using the NDK library), disconnecting WI-FI seems to not raies the stateUpdate(int newState) callback.

I do get a call to debugReturn and errorReturn on the Java side, but the state change callback is not being called.

Is this expected behavior?

Thanks
Lior

Comments

  • What Java side?
    Do you imply that you have 2 clients on different platforms and you kill the connection of a Java client (why do you have a Photon Java client at all, when you also have a NDK one? The only platform we currently offer a Java client for would be Android, but of course you have already covered that one with Android NDK) and the C++ network logic implementation that you have copy and pasted from the demo (the lib itself does not have anything called stateUpdate()) does not get a stateUpdate() call about that? That would be correct as the C++ clients own state hasn't changed, just the one of another player.
  • Sorry i wasn't so clear on this:

    We have the native (C++ code) that calls back to Java, passing state changes.

    AndroidNetworkLogic.cpp has a method called stateUpdate:

    void AndroidNetworkLogic::stateUpdate(State newState)
    {
    // Invoke the callback for state updates
    mEnv->CallVoidMethod(mJavaListener, mStateUpdateMethod, newState);
    }

    I don't think we added it, it is also there in NetworkLogic.h:

    virtual void stateUpdate(State newState) = 0;

    This callback reports state changes usually, but not in this particular case.. (local client disconnects).
  • So for debugReturn() and errorReturn() it works fine, but not for disconnectReturn()? Does disconnectReturn() itself get called and is this only happening in certain disconnect scenarios or with all disconnects, including regular ones?
  • Seems to be (didn't check, but in the logs i see disconnectReturn() )
  • Sorry, I have edited my post, while you have already answered, so here is the edit again so that it does not get overseen: "is this only happening in certain disconnect scenarios or with all disconnects, including regular ones?" If only in certain scenarios, then in which ones? What's the easiest way to reproduce it.
  • The scenario i've seen it with is:

    1. Connect to Photon on an Android device.
    2. After being connected, disable Wi-fi for the device.
    3. Wait for the stateUpdate callback to be called (it is not called).

    What other scenarios can i test with? manually calling disconnect() ?

    Lior
  • Hi Lior.

    I have tried to reproduce it with the demo, but with neither 3.2.2.0 nor 3.2.5.0 could I reproduce it. It definitely gets called just fine when deactivating Wifi on a Galaxy S2. Please be aware that it can take up to a few seconds until the OS let the socket report an error to Photon.