Skip to content

Commit a9f5fbc

Browse files
committed
feat: Add support for reflecting STUN requests from unbound clients.
1 parent 1fb20f7 commit a9f5fbc

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

include/juice/juice.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ typedef void (*juice_cb_gathering_done_t)(juice_agent_t *agent, void *user_ptr);
6464
typedef void (*juice_cb_recv_t)(juice_agent_t *agent, const char *data, size_t size,
6565
void *user_ptr);
6666

67-
typedef struct juice_mux_incoming {
67+
typedef struct juice_mux_binding_request {
6868
const char *local_ufrag;
6969
const char *remote_ufrag;
7070

7171
const char *address;
7272
uint16_t port;
73-
} juice_mux_incoming_t;
73+
} juice_mux_binding_request_t;
7474

75-
typedef void (*juice_cb_mux_incoming_t)(const juice_mux_incoming_t *info, void *user_ptr);
75+
typedef void (*juice_cb_mux_incoming_t)(const juice_mux_binding_request_t *info, void *user_ptr);
7676

7777
typedef struct juice_turn_server {
7878
const char *host;
@@ -129,7 +129,6 @@ JUICE_EXPORT int juice_get_selected_addresses(juice_agent_t *agent, char *local,
129129
JUICE_EXPORT int juice_set_local_ice_attributes(juice_agent_t *agent, const char *ufrag, const char *pwd);
130130
JUICE_EXPORT const char *juice_state_to_string(juice_state_t state);
131131
JUICE_EXPORT int juice_mux_listen(const char *bind_address, int local_port, juice_cb_mux_incoming_t cb, void *user_ptr);
132-
JUICE_EXPORT int juice_mux_stop_listen(const char *bind_address, int local_port);
133132

134133
// ICE server
135134

src/conn.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ int conn_get_addrs(juice_agent_t *agent, addr_record_t *records, size_t size) {
248248
return get_mode_entry(agent)->get_addrs_func(agent, records, size);
249249
}
250250

251-
int juice_mux_stop_listen(const char *bind_address, int local_port) {
251+
static int juice_mux_stop_listen(const char *bind_address, int local_port) {
252252
(void)bind_address;
253253
(void)local_port;
254254

@@ -277,6 +277,9 @@ int juice_mux_stop_listen(const char *bind_address, int local_port) {
277277

278278
int juice_mux_listen(const char *bind_address, int local_port, juice_cb_mux_incoming_t cb, void *user_ptr)
279279
{
280+
if (!cb)
281+
return juice_mux_stop_listen(bind_address, local_port);
282+
280283
conn_mode_entry_t *entry = &mode_entries[JUICE_CONCURRENCY_MODE_MUX];
281284

282285
udp_socket_config_t config;

src/conn_mux.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static juice_agent_t *lookup_agent(conn_registry_t *registry, char *buf, size_t
305305
return NULL;
306306
}
307307

308-
juice_mux_incoming_t incoming_info;
308+
juice_mux_binding_request_t incoming_info;
309309

310310
incoming_info.local_ufrag = local_ufrag;
311311
incoming_info.remote_ufrag = separator + 1;

0 commit comments

Comments
 (0)