zrtp_status_t zrtp_test_endpoint_destroy(zrtp_test_id_t id) { unsigned i; zrtp_status_t s = zrtp_status_ok; zrtp_endpoint_t *endpoint = zrtp_test_endpoint_by_id(id); endpoint->is_running = 0; if (endpoint->input_queue) { /* Push faked element to the queue to unlock incoming threads */ for (i=0; i<K_ZRTP_TEST_PROCESSORS_COUNT; i++) { zrtp_queue_elem_t *elem = malloc(sizeof(zrtp_queue_elem_t)); elem->size = 0; zrtp_test_queue_push(endpoint->input_queue, elem); } zrtp_sleep(0.5*1000); zrtp_test_queue_destroy(endpoint->input_queue); } for (i=0; i<20; i++) zrtp_sleep(100); if (endpoint) { /* Shut down libzrtp */ if (endpoint->zrtp) s = zrtp_down(endpoint->zrtp); /* Clean-up ZRTP cache after ourselves */ remove(endpoint->cfg.zrtp.def_cache_path.buffer); } else { s = zrtp_status_fail; } return s; }
static int module_close(void) { cmd_unregister(baresip_commands(), cmdv); menc_unregister(&menc_zrtp); if (zrtp_global) { zrtp_down(zrtp_global); zrtp_global = NULL; } return 0; }
void teardown() { zrtp_down(zrtp); }