ascii-chat 0.11.33
Video chat in your terminal
Loading...
Searching...
No Matches
connection_handle.h File Reference

Shared connection ownership handle for TCP and WebSocket clients. More...

Go to the source code of this file.

Data Structures

struct  connection_handle_t
 

Functions

void connection_handle_init (connection_handle_t *handle)
 
void connection_handle_cleanup (connection_handle_t *handle)
 

Detailed Description

Shared connection ownership handle for TCP and WebSocket clients.

Definition in file connection_handle.h.

Function Documentation

◆ connection_handle_cleanup()

void connection_handle_cleanup ( connection_handle_t *  handle)

Definition at line 16 of file connection_handle.c.

16 {
17 if (!handle) {
18 return;
19 }
20
21 if (handle->transport) {
22 acip_transport_close(handle->transport);
24 handle->transport = NULL;
25 }
26
27 if (handle->owner && handle->owner_destroy) {
28 handle->owner_destroy(handle->owner);
29 }
30
31 handle->owner = NULL;
32 handle->owner_destroy = NULL;
34}
acip_transport_t * transport
void(* owner_destroy)(void *owner)
acip_transport_type_t transport_type
void acip_transport_destroy(acip_transport_t *transport)
Destroy transport and free all resources.
@ ACIP_TRANSPORT_TCP
Raw TCP socket.
Definition transport.h:94

References acip_transport_destroy(), ACIP_TRANSPORT_TCP, connection_handle_t::owner, connection_handle_t::owner_destroy, connection_handle_t::transport, and connection_handle_t::transport_type.

Referenced by app_client_destroy(), and connection_context_cleanup().

◆ connection_handle_init()

void connection_handle_init ( connection_handle_t *  handle)

Definition at line 7 of file connection_handle.c.

7 {
8 if (!handle) {
9 return;
10 }
11
12 *handle = (connection_handle_t){0};
14}

References ACIP_TRANSPORT_TCP, and connection_handle_t::transport_type.

Referenced by app_client_create(), and connection_context_init().