]> git.meshlink.io Git - utcp/commitdiff
utcp_get_sndbuf_free() should return 0 if utcp_send() would fail.
authorGuus Sliepen <guus@meshlink.io>
Mon, 8 Dec 2014 15:16:34 +0000 (16:16 +0100)
committerGuus Sliepen <guus@meshlink.io>
Mon, 8 Dec 2014 15:16:34 +0000 (16:16 +0100)
utcp.c

diff --git a/utcp.c b/utcp.c
index f5484ab82b92e53e5365f7de75a822881218a7f4..186b63e90bba16798f7fe4d897c40e4c554cfd19 100644 (file)
--- 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) {
 }
 
 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) {
 }
 
 void utcp_set_sndbuf(struct utcp_connection *c, size_t size) {