static void op_fini (void *impl) { ctx_t *c = impl; assert (c->magic == CTX_MAGIC); flux_msg_iobuf_clean (&c->outbuf); flux_msg_iobuf_clean (&c->inbuf); if (c->fd >= 0) (void)close (c->fd); c->magic = ~CTX_MAGIC; free (c); }
static void client_destroy (client_t *c) { subscription_t *sub; ctx_t *ctx = c->ctx; if (c->disconnect_notify) { struct disconnect_notify *d; d = zhash_first (c->disconnect_notify); while (d) { disconnect_destroy (c, d); d = zhash_next (c->disconnect_notify); } zhash_destroy (&c->disconnect_notify); } if (c->subscriptions) { while ((sub = zlist_pop (c->subscriptions))) subscription_destroy (ctx->h, sub); zlist_destroy (&c->subscriptions); } if (c->uuid) zuuid_destroy (&c->uuid); if (c->outqueue) { flux_msg_t *msg; while ((msg = zlist_pop (c->outqueue))) flux_msg_destroy (msg); zlist_destroy (&c->outqueue); } flux_fd_watcher_stop (ctx->h, c->outw); flux_fd_watcher_destroy (c->outw); flux_msg_iobuf_clean (&c->outbuf); flux_fd_watcher_stop (ctx->h, c->inw); flux_fd_watcher_destroy (c->inw); flux_msg_iobuf_clean (&c->inbuf); if (c->fd != -1) close (c->fd); free (c); }