Skip to content

Commit f080952

Browse files
committed
Return -sockerrno when conn_send() failed
Currently, conn_*_send returns -1 on failure. Return more meaningful code to make debugging easier.
1 parent 1d915b7 commit f080952

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/conn_mux.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,6 +522,7 @@ int conn_mux_send(juice_agent_t *agent, const addr_record_t *dst, const char *da
522522

523523
int ret = udp_sendto(registry_impl->sock, data, size, dst);
524524
if (ret < 0) {
525+
ret = -sockerrno;
525526
if (sockerrno == SEAGAIN || sockerrno == SEWOULDBLOCK)
526527
JLOG_INFO("Send failed, buffer is full");
527528
else if (sockerrno == SEMSGSIZE)

src/conn_poll.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ int conn_poll_send(juice_agent_t *agent, const addr_record_t *dst, const char *d
412412

413413
int ret = udp_sendto(conn_impl->sock, data, size, dst);
414414
if (ret < 0) {
415+
ret = -sockerrno;
415416
if (sockerrno == SEAGAIN || sockerrno == SEWOULDBLOCK)
416417
JLOG_INFO("Send failed, buffer is full");
417418
else if (sockerrno == SEMSGSIZE)

src/conn_thread.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ int conn_thread_send(juice_agent_t *agent, const addr_record_t *dst, const char
260260

261261
int ret = udp_sendto(conn_impl->sock, data, size, dst);
262262
if (ret < 0) {
263+
ret = -sockerrno;
263264
if (sockerrno == SEAGAIN || sockerrno == SEWOULDBLOCK)
264265
JLOG_INFO("Send failed, buffer is full");
265266
else if (sockerrno == SEMSGSIZE)

0 commit comments

Comments
 (0)