summaryrefslogtreecommitdiff
path: root/toxcore/net_crypto.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2017-06-05 00:46:38 +0000
committeriphydf <iphydf@users.noreply.github.com>2017-06-05 12:18:26 +0000
commit1bbe446760c82500723edc4adce8a4b430a4aa1e (patch)
tree215e294e6df833acd400d1cfafdb3a245bb04a31 /toxcore/net_crypto.c
parentced07d6700021e4376317c25210550d88d2a83d8 (diff)
Document inverted mutex lock/unlock.
All other code in this file does lock/call/unlock, except this one instance, so we should explain why.
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r--toxcore/net_crypto.c2
1 files changed, 2 insertions, 0 deletions
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
1957 return tcp_handle_cookie_request(c, conn->connection_number_tcp, data, length); 1957 return tcp_handle_cookie_request(c, conn->connection_number_tcp, data, length);
1958 } 1958 }
1959 1959
1960 // This unlocks the mutex that at this point is locked by do_tcp before
1961 // calling do_tcp_connections.
1960 pthread_mutex_unlock(&c->tcp_mutex); 1962 pthread_mutex_unlock(&c->tcp_mutex);
1961 int ret = handle_packet_connection(c, id, data, length, 0, userdata); 1963 int ret = handle_packet_connection(c, id, data, length, 0, userdata);
1962 pthread_mutex_lock(&c->tcp_mutex); 1964 pthread_mutex_lock(&c->tcp_mutex);