From 96b97ab1291e339a36952532db8ce72e7efc45a1 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sat, 8 Feb 2020 15:59:41 +0100 Subject: [PATCH] Fix garbage being sent at start of UDP connection. If utcp_send() was called right after utcp_connect_ex(..., UTCP_UDP), and the handshake phase hadn't completed yet, we left some garbage in the send buffer which wasn't cleared until two more calls to utcp_send() were made. --- utcp.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utcp.c b/utcp.c index c57a5cc..5d63069 100644 --- a/utcp.c +++ b/utcp.c @@ -629,6 +629,8 @@ ssize_t utcp_send(struct utcp_connection *c, const void *data, size_t len) { if(is_reliable(c) || (c->state != SYN_SENT && c->state != SYN_RECEIVED)) { len = buffer_put(&c->sndbuf, data, len); + } else { + return 0; } if(len <= 0) { -- 2.39.5