Skip to content

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

@liaojinxing

Description

@liaojinxing
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions