From a4e2223575a4b0659bcbffeb73e636d5ba5847bc Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Mon, 8 Dec 2014 16:16:34 +0100 Subject: [PATCH] utcp_get_sndbuf_free() should return 0 if utcp_send() would fail. --- utcp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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) { -- 2.39.5