From: Guus Sliepen Date: Mon, 8 Dec 2014 15:16:34 +0000 (+0100) Subject: utcp_get_sndbuf_free() should return 0 if utcp_send() would fail. X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=a4e2223575a4b0659bcbffeb73e636d5ba5847bc;p=utcp utcp_get_sndbuf_free() should return 0 if utcp_send() would fail. --- diff --git a/utcp.c b/utcp.c index f5484ab..186b63e 100644 --- a/utcp.c +++ b/utcp.c @@ -1174,7 +1174,10 @@ size_t utcp_get_sndbuf(struct utcp_connection *c) { } size_t utcp_get_sndbuf_free(struct utcp_connection *c) { - return buffer_free(&c->sndbuf); + if(c->state == ESTABLISHED || c->state == CLOSE_WAIT) + return buffer_free(&c->sndbuf); + else + return 0; } void utcp_set_sndbuf(struct utcp_connection *c, size_t size) {