Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove publish handlers on disconnect seems not making sense if qos > 0 #41

Open
liaojinxing opened this issue Jan 5, 2016 · 0 comments

Comments

@liaojinxing
Copy link

static void on_disconnect(struct mosquitto *mosq, void *obj, int rc)
{
    MQTTClient* client = (__bridge MQTTClient*)obj;
    LogDebug(@"[%@] on_disconnect rc = %d", client.clientID, rc);
    [client.publishHandlers removeAllObjects];
    [client.subscriptionHandlers removeAllObjects];
    [client.unsubscriptionHandlers removeAllObjects];
    client.connected = NO;
    if (client.disconnectionHandler) {
        client.disconnectionHandler(rc);
    }
}

Inside on_disconnect method, remove all the callbacks including publishHandlers, subscriptionHandlers, and unsubscriptionHandlers.
If the publish qos is AtLeastOnce or ExactlyOnce, remove the publishHandlers on disconnect seems not making sense.

@liaojinxing liaojinxing changed the title Why remove callback handlers on disconnect remove publish handlers on disconnect seems not making sense if qos > 0 Jan 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant