Skip to content

Commit aa85a48

Browse files
committed
Add juice_send_detailed
Add a new juice_send variant to expose the conn_send result to the user.
1 parent 9bda484 commit aa85a48

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

include/juice/juice.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ JUICE_EXPORT int juice_add_remote_candidate(juice_agent_t *agent, const char *sd
111111
JUICE_EXPORT int juice_add_turn_server(juice_agent_t *agent, const juice_turn_server_t *turn_server);
112112
JUICE_EXPORT int juice_set_remote_gathering_done(juice_agent_t *agent);
113113
JUICE_EXPORT int juice_send(juice_agent_t *agent, const char *data, size_t size);
114+
JUICE_EXPORT int juice_send_detailed(juice_agent_t *agent, const char *data, size_t size, int* ret);
114115
JUICE_EXPORT int juice_send_diffserv(juice_agent_t *agent, const char *data, size_t size, int ds);
115116
JUICE_EXPORT juice_state_t juice_get_state(juice_agent_t *agent);
116117
JUICE_EXPORT int juice_get_selected_candidates(juice_agent_t *agent, char *local, size_t local_size,

src/juice.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,18 @@ JUICE_EXPORT int juice_set_remote_gathering_done(juice_agent_t *agent) {
8585
}
8686

8787
JUICE_EXPORT int juice_send(juice_agent_t *agent, const char *data, size_t size) {
88+
int ret;
89+
return juice_send_detailed(agent, data, size, &ret);
90+
}
91+
92+
JUICE_EXPORT int juice_send_detailed(juice_agent_t *agent, const char *data, size_t size, int *ret) {
8893
if (!agent || (!data && size))
8994
return JUICE_ERR_INVALID;
9095

91-
if (agent_send(agent, data, size, 0) < 0)
96+
*ret = agent_send(agent, data, size, 0);
97+
if (*ret < 0) {
9298
return JUICE_ERR_FAILED;
99+
}
93100

94101
return JUICE_ERR_SUCCESS;
95102
}

0 commit comments

Comments
 (0)