summaryrefslogtreecommitdiff
path: root/protocols/Tox/libtox/src/toxcore
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2017-12-21 00:02:10 +0300
committeraunsane <aunsane@gmail.com>2017-12-21 00:02:10 +0300
commitb60db432a3232b0569db7d39c04479efbcc9b73d (patch)
treebf9179bc32d538092eb029971ff191ecf187e74f /protocols/Tox/libtox/src/toxcore
parentb8fc5f5dd8f83d1c3d40a15ec28ac320de21dabd (diff)
Tox: updated libtox
Diffstat (limited to 'protocols/Tox/libtox/src/toxcore')
-rw-r--r--protocols/Tox/libtox/src/toxcore/Messenger.c10
-rw-r--r--protocols/Tox/libtox/src/toxcore/net_crypto.c4
-rw-r--r--protocols/Tox/libtox/src/toxcore/util.c1
-rw-r--r--protocols/Tox/libtox/src/toxcore/util.h2
4 files changed, 10 insertions, 7 deletions
diff --git a/protocols/Tox/libtox/src/toxcore/Messenger.c b/protocols/Tox/libtox/src/toxcore/Messenger.c
index 4dd7d0c4a4..e821f53530 100644
--- a/protocols/Tox/libtox/src/toxcore/Messenger.c
+++ b/protocols/Tox/libtox/src/toxcore/Messenger.c
@@ -375,8 +375,6 @@ static int do_receipts(Messenger *m, int32_t friendnumber, void *userdata)
struct Receipts *receipts = m->friendlist[friendnumber].receipts_start;
while (receipts) {
- struct Receipts *temp_r = receipts->next;
-
if (friend_received_packet(m, friendnumber, receipts->packet_num) == -1) {
break;
}
@@ -385,9 +383,13 @@ static int do_receipts(Messenger *m, int32_t friendnumber, void *userdata)
(*m->read_receipt)(m, friendnumber, receipts->msg_id, userdata);
}
+ struct Receipts *r_next = receipts->next;
+
free(receipts);
- m->friendlist[friendnumber].receipts_start = temp_r;
- receipts = temp_r;
+
+ m->friendlist[friendnumber].receipts_start = r_next;
+
+ receipts = r_next;
}
if (!m->friendlist[friendnumber].receipts_start) {
diff --git a/protocols/Tox/libtox/src/toxcore/net_crypto.c b/protocols/Tox/libtox/src/toxcore/net_crypto.c
index 37cbab188f..440db94abd 100644
--- a/protocols/Tox/libtox/src/toxcore/net_crypto.c
+++ b/protocols/Tox/libtox/src/toxcore/net_crypto.c
@@ -2811,12 +2811,12 @@ Net_Crypto *new_net_crypto(Logger *log, DHT *dht, TCP_Proxy_Info *proxy_info)
set_packet_tcp_connection_callback(temp->tcp_c, &tcp_data_callback, temp);
set_oob_packet_tcp_connection_callback(temp->tcp_c, &tcp_oob_callback, temp);
- /*if (create_recursive_mutex(&temp->tcp_mutex) != 0 ||
+ if (create_recursive_mutex(&temp->tcp_mutex) != 0 ||
pthread_mutex_init(&temp->connections_mutex, NULL) != 0) {
kill_tcp_connections(temp->tcp_c);
free(temp);
return NULL;
- }*/
+ }
temp->dht = dht;
diff --git a/protocols/Tox/libtox/src/toxcore/util.c b/protocols/Tox/libtox/src/toxcore/util.c
index 5202598518..92bbb68c1f 100644
--- a/protocols/Tox/libtox/src/toxcore/util.c
+++ b/protocols/Tox/libtox/src/toxcore/util.c
@@ -183,6 +183,7 @@ int create_recursive_mutex(pthread_mutex_t *mutex)
return -1;
}
+ /* Create queue mutex */
if (pthread_mutex_init(mutex, &attr) != 0) {
pthread_mutexattr_destroy(&attr);
return -1;
diff --git a/protocols/Tox/libtox/src/toxcore/util.h b/protocols/Tox/libtox/src/toxcore/util.h
index 6ef9a75f8c..8777e191d8 100644
--- a/protocols/Tox/libtox/src/toxcore/util.h
+++ b/protocols/Tox/libtox/src/toxcore/util.h
@@ -59,6 +59,6 @@ int load_state(load_state_callback_func load_state_callback, Logger *log, void *
const uint8_t *data, uint32_t length, uint16_t cookie_inner);
/* Returns -1 if failed or 0 if success */
-//int create_recursive_mutex(pthread_mutex_t *mutex);
+int create_recursive_mutex(pthread_mutex_t *mutex);
#endif /* UTIL_H */