rudp_error_t rudp_client_close(struct rudp_client *client) { rudp_peer_send_close_noqueue(&client->peer); rudp_peer_deinit(&client->peer); rudp_endpoint_close(&client->endpoint); return 0; }
static void client_peer_dropped(struct rudp_peer *peer) { struct rudp_client *client = __container_of(struct rudp_client*, peer, client, peer); client->connected = 0; rudp_peer_deinit(&client->peer); rudp_endpoint_close(&client->endpoint); client->handler->server_lost(client); }
rudp_error_t rudp_client_close(struct rudp_client *client) { /* Avoid SEGFAULT in case rudp_client_connect() hasn't been called yet. */ if (client->peer.endpoint == NULL) return 0; rudp_peer_send_close_noqueue(&client->peer); rudp_peer_deinit(&client->peer); rudp_endpoint_close(&client->endpoint); return 0; }