From 1bbe446760c82500723edc4adce8a4b430a4aa1e Mon Sep 17 00:00:00 2001 From: iphydf Date: Mon, 5 Jun 2017 00:46:38 +0000 Subject: Document inverted mutex lock/unlock. All other code in this file does lock/call/unlock, except this one instance, so we should explain why. --- toxcore/net_crypto.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'toxcore/net_crypto.c') diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 0390e44e..606561bb 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -1957,6 +1957,8 @@ static int tcp_data_callback(void *object, int id, const uint8_t *data, uint16_t return tcp_handle_cookie_request(c, conn->connection_number_tcp, data, length); } + // This unlocks the mutex that at this point is locked by do_tcp before + // calling do_tcp_connections. pthread_mutex_unlock(&c->tcp_mutex); int ret = handle_packet_connection(c, id, data, length, 0, userdata); pthread_mutex_lock(&c->tcp_mutex); -- cgit v1.2.3