From bcfb1261ac4ab5f6470924f473c8c18bc5f98f01 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Wed, 16 Jul 2014 20:39:58 -0400 Subject: Fixed possible bug with TCP nonce not getting incremented. --- toxcore/TCP_client.c | 4 ++-- toxcore/TCP_server.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'toxcore') diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c index 02d4e7dc..45220538 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c @@ -231,10 +231,10 @@ static int write_packet_TCP_secure_connection(TCP_Client_Connection *con, const if (len <= 0) { len = 0; - } else { - increment_nonce(con->sent_nonce); } + increment_nonce(con->sent_nonce); + if (len == sizeof(packet)) { return 1; } diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c index f3cdd287..47e2ff27 100644 --- a/toxcore/TCP_server.c +++ b/toxcore/TCP_server.c @@ -411,10 +411,10 @@ static int write_packet_TCP_secure_connection(TCP_Secure_Connection *con, const if (len <= 0) { len = 0; - } else { - increment_nonce(con->sent_nonce); } + increment_nonce(con->sent_nonce); + if (len == sizeof(packet)) { return 1; } -- cgit v1.2.3