lib/ovsdb-idl.c
/* Changes the remote and creates a new session.
 *
 * If 'retry' is true, the connection to the remote will automatically retry
 * when it fails.  If 'retry' is false, the connection is one-time. */
Changes the remote and creates a new session.
If 'retry' is true, the connection to the remote will automatically retry
when it fails.  If 'retry' is false, the connection is one-time.
Changes the remote and creates a new session . If ' retry ' is true the connection to the remote will automatically retry when it fails . If ' retry ' is false the connection is one - time .
void
ovsdb_idl_set_remote(struct ovsdb_idl *idl, const char *remote, bool retry)
{
    if (idl
        && ((remote != NULL) != (idl->remote != NULL)
            || (remote && idl->remote && strcmp(remote, idl->remote)))) {
        ovs_assert(!idl->data.txn);
        if (idl->session) {
            jsonrpc_session_close(idl->session);
            idl->session = NULL;
            free(idl->remote);
            idl->remote = NULL;
        }
        if (remote) {
            struct svec remotes = SVEC_EMPTY_INITIALIZER;
            ovsdb_session_parse_remote(remote, &remotes, &idl->cid);
            if (idl->shuffle_remotes) {
                svec_shuffle(&remotes);
            }
            idl->session = jsonrpc_session_open_multiple(&remotes, retry);
            svec_destroy(&remotes);
            idl->state_seqno = UINT_MAX;
            idl->remote = xstrdup(remote);
        }
    }
}
void ovsdb_idl_set_remote ( struct ovsdb_idl * idl , const char * remote , bool retry ) { if ( idl && ( ( remote != NULL ) != ( idl -> remote != NULL ) || ( remote && idl -> remote && strcmp ( remote , idl -> remote ) ) ) ) { ovs_assert ( ! idl -> data . txn ) ; if ( idl -> session ) { jsonrpc_session_close ( idl -> session ) ; idl -> session = NULL ; free ( idl -> remote ) ; idl -> remote = NULL ; } if ( remote ) { struct svec remotes = SVEC_EMPTY_INITIALIZER ; ovsdb_session_parse_remote ( remote , & remotes , & idl -> cid ) ; if ( idl -> shuffle_remotes ) { svec_shuffle ( & remotes ) ; } idl -> session = jsonrpc_session_open_multiple ( & remotes , retry ) ; svec_destroy ( & remotes ) ; idl -> state_seqno = UINT_MAX ; idl -> remote = xstrdup ( remote ) ; } } }
Changes the remote and creates a new session.
Changes the remote and creates a new session .
/* Close the old session, if any. */ /* Open new session, if any. */