cs_error_t quorum_finalize ( quorum_handle_t handle) { struct quorum_inst *quorum_inst; cs_error_t error; error = hdb_error_to_cs(hdb_handle_get (&quorum_handle_t_db, handle, (void *)&quorum_inst)); if (error != CS_OK) { return (error); } /* * Another thread has already started finalizing */ if (quorum_inst->finalize) { (void)hdb_handle_put (&quorum_handle_t_db, handle); return (CS_ERR_BAD_HANDLE); } quorum_inst->finalize = 1; qb_ipcc_disconnect (quorum_inst->c); (void)hdb_handle_destroy (&quorum_handle_t_db, handle); (void)hdb_handle_put (&quorum_handle_t_db, handle); return (CS_OK); }
cs_error_t cmap_finalize(cmap_handle_t handle) { struct cmap_inst *cmap_inst; cs_error_t error; hdb_handle_t track_inst_handle = 0; struct cmap_track_inst *cmap_track_inst; error = hdb_error_to_cs(hdb_handle_get(&cmap_handle_t_db, handle, (void *)&cmap_inst)); if (error != CS_OK) { return (error); } qb_ipcc_disconnect(cmap_inst->c); /* * Destroy all track instances for given connection */ hdb_iterator_reset(&cmap_track_handle_t_db); while (hdb_iterator_next(&cmap_track_handle_t_db, (void*)&cmap_track_inst, &track_inst_handle) == 0) { if (cmap_track_inst->c == cmap_inst->c) { (void)hdb_handle_destroy(&cmap_track_handle_t_db, track_inst_handle); } (void)hdb_handle_put (&cmap_track_handle_t_db, track_inst_handle); } (void)hdb_handle_destroy(&cmap_handle_t_db, handle); (void)hdb_handle_put(&cmap_handle_t_db, handle); return (CS_OK); }
unsigned int pload_finalize ( pload_handle_t handle) { struct pload_inst *pload_inst; cs_error_t error; error = hdb_error_to_cs (hdb_handle_get (&pload_handle_t_db, handle, (void *)&pload_inst)); if (error != CS_OK) { return (error); } /* * Another thread has already started finalizing */ if (pload_inst->finalize) { (void)hdb_handle_put (&pload_handle_t_db, handle); return (PLOAD_ERR_BAD_HANDLE); } pload_inst->finalize = 1; qb_ipcc_disconnect(pload_inst->c); (void)hdb_handle_destroy (&pload_handle_t_db, handle); (void)hdb_handle_put (&pload_handle_t_db, handle); return (PLOAD_OK); }
void crm_ipc_close(crm_ipc_t *client) { crm_trace("Disconnecting %s IPC connection %p (%p.%d)", client->name, client, client->ipc); if(client && client->ipc) { qb_ipcc_connection_t *ipc = client->ipc; client->ipc = NULL; qb_ipcc_disconnect(ipc); } }
void IPCClientPrivate::disconnect() { if (_qb_conn != nullptr && _qb_conn_fd != -1) { qb_loop_poll_del(_qb_loop, _qb_conn_fd); qb_ipcc_disconnect(_qb_conn); _qb_conn = nullptr; _qb_conn_fd = -1; _p_instance.IPCDisconnected(); } return; }
int main(int argc, char *argv[]) { qb_ipcc_connection_t *conn; const char *options = "eb"; int32_t opt; while ((opt = getopt(argc, argv, options)) != -1) { switch (opt) { case 'b': do_benchmark = QB_TRUE; break; case 'e': use_events = QB_TRUE; break; case 'h': default: show_usage(argv[0]); exit(0); break; } } qb_log_init("ipcclient", LOG_USER, LOG_TRACE); qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE); qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*", LOG_TRACE); qb_log_format_set(QB_LOG_STDERR, "%f:%l [%p] %b"); qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE); /* Our example server is enforcing a buffer size minimum, * so the client does not need to be concerned with setting * the buffer size */ conn = qb_ipcc_connect("ipcserver", 0); if (conn == NULL) { perror("qb_ipcc_connect"); exit(1); } data = calloc(1, qb_ipcc_get_buffer_size(conn)); if (do_benchmark) { do_throughput_benchmark(conn); } else { do_echo(conn); } qb_ipcc_disconnect(conn); free(data); return EXIT_SUCCESS; }
int main(int argc, char *argv[]) { qb_ipcc_connection_t *conn; const char *options = "eb"; int32_t opt; while ((opt = getopt(argc, argv, options)) != -1) { switch (opt) { case 'b': do_benchmark = QB_TRUE; break; case 'e': use_events = QB_TRUE; break; case 'h': default: show_usage(argv[0]); exit(0); break; } } qb_log_init("ipcclient", LOG_USER, LOG_TRACE); qb_log_ctl(QB_LOG_SYSLOG, QB_LOG_CONF_ENABLED, QB_FALSE); qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*", LOG_TRACE); qb_log_format_set(QB_LOG_STDERR, "%f:%l [%p] %b"); qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE); conn = qb_ipcc_connect("ipcserver", MAX_MSG_SIZE); if (conn == NULL) { perror("qb_ipcc_connect"); exit(1); } if (do_benchmark) { do_throughput_benchmark(conn); } else { do_echo(conn); } qb_ipcc_disconnect(conn); return EXIT_SUCCESS; }
void IPCClientPrivate::connect() { _qb_conn = qb_ipcc_connect("usbguard", 1<<20); if (_qb_conn == nullptr) { throw IPCException(IPCException::ConnectionError, "IPC Connection not established"); } qb_ipcc_fd_get(_qb_conn, &_qb_conn_fd); if (_qb_conn_fd < 0) { qb_ipcc_disconnect(_qb_conn); _qb_conn = nullptr; _qb_conn_fd = -1; throw IPCException(IPCException::ConnectionError, "Bad file descriptor"); } qb_loop_poll_add(_qb_loop, QB_LOOP_HIGH, _qb_conn_fd, POLLIN, this, qbIPCMessageProcessFn); _p_instance.IPCConnected(); return; }
static void bmc_disconnect(struct bm_ctx *ctx) { qb_ipcc_disconnect(ctx->conn); qb_util_stopwatch_free(ctx->sw); }
static void cmap_inst_free (void *inst) { struct cmap_inst *cmap_inst = (struct cmap_inst *)inst; qb_ipcc_disconnect(cmap_inst->c); }
static void votequorum_inst_free (void *inst) { struct votequorum_inst *vq_inst = (struct votequorum_inst *)inst; qb_ipcc_disconnect(vq_inst->c); }
static void quorum_inst_free (void *inst) { struct quorum_inst *quorum_inst = (struct quorum_inst *)inst; qb_ipcc_disconnect(quorum_inst->c); }