diff options
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r-- | toxcore/net_crypto.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 2f125fdc..87541d9f 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -2696,22 +2696,12 @@ Net_Crypto *new_net_crypto(DHT *dht, TCP_Proxy_Info *proxy_info) | |||
2696 | if (temp == NULL) | 2696 | if (temp == NULL) |
2697 | return NULL; | 2697 | return NULL; |
2698 | 2698 | ||
2699 | pthread_mutexattr_t attr; | 2699 | if (create_recursive_mutex(&temp->tcp_mutex) != 0 || |
2700 | 2700 | pthread_mutex_init(&temp->connections_mutex, NULL) != 0) { | |
2701 | if (pthread_mutexattr_init(&attr) == 0) { | ||
2702 | if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0 || pthread_mutex_init(&temp->tcp_mutex, &attr) != 0 | ||
2703 | || pthread_mutex_init(&temp->connections_mutex, NULL) != 0) { | ||
2704 | pthread_mutexattr_destroy(&attr); | ||
2705 | free(temp); | ||
2706 | return NULL; | ||
2707 | } | ||
2708 | } else { | ||
2709 | free(temp); | 2701 | free(temp); |
2710 | return NULL; | 2702 | return NULL; |
2711 | } | 2703 | } |
2712 | 2704 | ||
2713 | pthread_mutexattr_destroy(&attr); | ||
2714 | |||
2715 | temp->dht = dht; | 2705 | temp->dht = dht; |
2716 | 2706 | ||
2717 | new_keys(temp); | 2707 | new_keys(temp); |