summaryrefslogtreecommitdiff
path: root/toxcore/TCP_connection.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2017-01-05 18:19:05 +0000
committeriphydf <iphydf@users.noreply.github.com>2017-01-11 17:25:39 +0000
commit583d71680ec12349cd1bedea72ae136d55667ecb (patch)
tree9b90c696786e80ef96da8e4fb53599515675c3a6 /toxcore/TCP_connection.c
parent958aa43bdf009487527dadd8bda7e629d572e998 (diff)
Check that TCP connections aren't dropped in callbacks.
They aren't, but it's unclear whether it's structurally impossible.
Diffstat (limited to 'toxcore/TCP_connection.c')
-rw-r--r--toxcore/TCP_connection.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/toxcore/TCP_connection.c b/toxcore/TCP_connection.c
index e8f51273..a9218210 100644
--- a/toxcore/TCP_connection.c
+++ b/toxcore/TCP_connection.c
@@ -29,6 +29,8 @@
29 29
30#include "util.h" 30#include "util.h"
31 31
32#include <assert.h>
33
32 34
33struct TCP_Connections { 35struct TCP_Connections {
34 DHT *dht; 36 DHT *dht;
@@ -1397,6 +1399,9 @@ static void do_tcp_conns(TCP_Connections *tcp_c, void *userdata)
1397 /* callbacks can change TCP connection address. */ 1399 /* callbacks can change TCP connection address. */
1398 tcp_con = get_tcp_connection(tcp_c, i); 1400 tcp_con = get_tcp_connection(tcp_c, i);
1399 1401
1402 // Make sure the TCP connection wasn't dropped in any of the callbacks.
1403 assert(tcp_con != NULL);
1404
1400 if (tcp_con->connection->status == TCP_CLIENT_DISCONNECTED) { 1405 if (tcp_con->connection->status == TCP_CLIENT_DISCONNECTED) {
1401 if (tcp_con->status == TCP_CONN_CONNECTED) { 1406 if (tcp_con->status == TCP_CONN_CONNECTED) {
1402 reconnect_tcp_relay_connection(tcp_c, i); 1407 reconnect_tcp_relay_connection(tcp_c, i);