[ovs-dev] [connmgr 15/15] ofproto: Factor OpenFlow connection management into new "connmgr".

Ethan Jackson ethan at nicira.com
Tue Mar 29 18:56:15 UTC 2011


> +/* Frees 'mgr' and all of its resources. */
> +void
> +connmgr_destroy(struct connmgr *mgr)
> +{
> +    struct ofservice *ofservice, *next_ofservice;
> +    struct ofconn *ofconn, *next_ofconn;
> +    size_t i;
> +
> +    if (!mgr) {
> +        return;
> +    }
> +
> +    LIST_FOR_EACH_SAFE (ofconn, next_ofconn, node, &mgr->all_conns) {
> +        ofconn_destroy(ofconn);
> +    }
> +    hmap_destroy(&mgr->controllers);
> +
> +    HMAP_FOR_EACH_SAFE (ofservice, next_ofservice, node, &mgr->services) {
> +        ofservice_destroy(mgr, ofservice);
> +    }
> +    hmap_destroy(&mgr->services);
> +
> +    for (i = 0; i < mgr->n_snoops; i++) {
> +        pvconn_close(mgr->snoops[i]);
> +    }
> +    free(mgr->snoops);
> +
> +    fail_open_destroy(mgr->fail_open);
> +    mgr->fail_open = NULL;
> +
> +    in_band_destroy(mgr->in_band);
> +    mgr->in_band = NULL;
> +    free(mgr->extra_in_band_remotes);
> +
> +    free(mgr);
> +}

mgr->name and mgr->local_port_name need to be freed.

Otherwise looks good.

Ethan



More information about the dev mailing list