diff --git a/mongoose.c b/mongoose.c index 8a8f3827..ceb2b7d7 100644 --- a/mongoose.c +++ b/mongoose.c @@ -3043,7 +3043,7 @@ void mg_if_can_send_cb(struct mg_connection *nc) { } } else #endif - { + if (len > 0) { if (nc->flags & MG_F_UDP) { n = nc->iface->vtable->udp_send(nc, buf, len); } else { @@ -3673,7 +3673,7 @@ int mg_null_if_udp_recv(struct mg_connection *c, void *buf, size_t len, static int mg_null_if_create_conn(struct mg_connection *c) { (void) c; - return -1; + return 1; } static void mg_null_if_destroy_conn(struct mg_connection *c) { diff --git a/src/mg_net.c b/src/mg_net.c index 3862fa89..2aed7df0 100644 --- a/src/mg_net.c +++ b/src/mg_net.c @@ -734,7 +734,7 @@ void mg_if_can_send_cb(struct mg_connection *nc) { } } else #endif - { + if (len > 0) { if (nc->flags & MG_F_UDP) { n = nc->iface->vtable->udp_send(nc, buf, len); } else { diff --git a/src/mg_net_if_null.c b/src/mg_net_if_null.c index 2142b1e6..cf8bbaa1 100644 --- a/src/mg_net_if_null.c +++ b/src/mg_net_if_null.c @@ -75,7 +75,7 @@ int mg_null_if_udp_recv(struct mg_connection *c, void *buf, size_t len, static int mg_null_if_create_conn(struct mg_connection *c) { (void) c; - return -1; + return 1; } static void mg_null_if_destroy_conn(struct mg_connection *c) {