The documentation in zookeeper.h states:

 *   clientid the id of a previously established session that this
* client will be reconnecting to. Pass 0 if not reconnecting to a previous
 *   session. If the session timed out or the id is invalid, a new
* session will be automatically generated. Clients should check the actual
 *   session id by calling \ref zoo_client_id.

The implementation of zookeeper_init appears to enter EXPIRED_SESSION_STATE instead of automatically generating a new session id.

Would it be safe to remove this block in zookeeper.c check_events():

if (oldid != 0 && oldid != newid) {
    zh->state = EXPIRED_SESSION_STATE;
    errno = ESTALE;
    return handle_socket_error_msg(zh,__LINE__,ZSESSIONEXPIRED,
            "session %llx has expired.",oldid);
} else {

so that the new session continues to CONNECTED_STATE? It would be useful to receive a session expired notification without aborting the connection.



Reply via email to