void connection_free(connection_t* con) { comms_disconnect(con->socketfd); if(con->uri != NULL) uri_free(con->uri); if(con->name != NULL) free(con->name); free(con); }
void comms_destroy(struct th_data *data) { odprintf("comms[destroy]"); #if HAVE_GETADDRINFO if (data->addrs_res != NULL) { freeaddrinfo(data->addrs_res); data->addrs_res = NULL; } #endif comms_disconnect(data); }
void topic_remove_connection(topic_t* t, connection_t* con) { comms_disconnect(con->socketfd); list_item_t* item = t->conns->begin; while(item != NULL) { if(item->data == con) { connection_free(con); list_remove_item(t->conns, item); return; } item = item->next; } }