Пример #1
0
static void
cib_ipc_destroy(qb_ipcs_connection_t * c)
{
    crm_trace("Connection %p", c);
    cib_ipc_closed(c);
    if (cib_shutdown_flag) {
        cib_shutdown(0);
    }
}
Пример #2
0
void
cib_remote_connection_destroy(gpointer user_data)
{
    crm_client_t *client = user_data;
    int csock = 0;

    if (client == NULL) {
        return;
    }

    crm_trace("Cleaning up after client disconnect: %s/%s", crm_str(client->name), client->id);

    num_clients--;
    crm_trace("Num unfree'd clients: %d", num_clients);

    switch (client->kind) {
        case CRM_CLIENT_TCP:
            csock = client->remote->tcp_socket;
            break;
#ifdef HAVE_GNUTLS_GNUTLS_H
        case CRM_CLIENT_TLS:
            if (client->remote->tls_session) {
                void *sock_ptr = gnutls_transport_get_ptr(*client->remote->tls_session);

                csock = GPOINTER_TO_INT(sock_ptr);
                if (client->remote->tls_handshake_complete) {
                    gnutls_bye(*client->remote->tls_session, GNUTLS_SHUT_WR);
                }
                gnutls_deinit(*client->remote->tls_session);
                gnutls_free(client->remote->tls_session);
                client->remote->tls_session = NULL;
            }
            break;
#endif
        default:
            crm_warn("Unexpected client type %d", client->kind);
    }

    if (csock > 0) {
        close(csock);
    }

    crm_client_destroy(client);

    crm_trace("Freed the cib client");

    if (cib_shutdown_flag) {
        cib_shutdown(0);
    }
    return;
}
Пример #3
0
static void
cib_ipc_destroy(qb_ipcs_connection_t *c) 
{
    cib_client_t *cib_client = qb_ipcs_context_get(c);

    CRM_ASSERT(cib_client != NULL);
    CRM_ASSERT(cib_client->id != NULL);

    /* In case we arrive here without a call to cib_ipc_close() */
    g_hash_table_remove(client_list, cib_client->id);

    crm_trace("Destroying %s (%p)", cib_client->name, c);
    free(cib_client->name);
    free(cib_client->callback_id);
    free(cib_client->id);
    free(cib_client->user);
    free(cib_client);
    crm_trace("Freed the cib client");

    if (cib_shutdown_flag) {
        cib_shutdown(0);
    }
}