summaryrefslogtreecommitdiff
path: root/toxcore/TCP_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/TCP_client.c')
-rw-r--r--toxcore/TCP_client.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c
index bc1b7ff4..2a2289b2 100644
--- a/toxcore/TCP_client.c
+++ b/toxcore/TCP_client.c
@@ -155,16 +155,16 @@ static int write_packet_TCP_secure_connection(TCP_Client_Connection *con, const
155 if ((unsigned int)len != (sizeof(packet) - sizeof(uint16_t))) 155 if ((unsigned int)len != (sizeof(packet) - sizeof(uint16_t)))
156 return -1; 156 return -1;
157 157
158 increment_nonce(con->sent_nonce);
159
160 len = send(con->sock, packet, sizeof(packet), MSG_NOSIGNAL); 158 len = send(con->sock, packet, sizeof(packet), MSG_NOSIGNAL);
161 159
162 if ((unsigned int)len == sizeof(packet))
163 return 1;
164
165 if (len <= 0) 160 if (len <= 0)
166 return 0; 161 return 0;
167 162
163 increment_nonce(con->sent_nonce);
164
165 if ((unsigned int)len == sizeof(packet))
166 return 1;
167
168 memcpy(con->last_packet, packet, length); 168 memcpy(con->last_packet, packet, length);
169 con->last_packet_length = sizeof(packet); 169 con->last_packet_length = sizeof(packet);
170 con->last_packet_sent = len; 170 con->last_packet_sent = len;