diff options
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/Messenger.h | 1 | ||||
-rw-r--r-- | toxcore/net_crypto.c | 10 |
2 files changed, 6 insertions, 5 deletions
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 6943475f..984fa545 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #define MESSENGER_H | 27 | #define MESSENGER_H |
28 | 28 | ||
29 | #include "friend_requests.h" | 29 | #include "friend_requests.h" |
30 | #include "LAN_discovery.h" | ||
31 | #include "friend_connection.h" | 30 | #include "friend_connection.h" |
32 | 31 | ||
33 | #define MAX_NAME_LENGTH 128 | 32 | #define MAX_NAME_LENGTH 128 |
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 0ed855bb..b7c634de 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -1547,12 +1547,13 @@ int accept_crypto_connection(Net_Crypto *c, New_Connection *n_c) | |||
1547 | return -1; | 1547 | return -1; |
1548 | 1548 | ||
1549 | pthread_mutex_lock(&c->tcp_mutex); | 1549 | pthread_mutex_lock(&c->tcp_mutex); |
1550 | conn->connection_number_tcp = new_tcp_connection_to(c->tcp_c, n_c->dht_public_key, crypt_connection_id); | 1550 | int connection_number_tcp = new_tcp_connection_to(c->tcp_c, n_c->dht_public_key, crypt_connection_id); |
1551 | pthread_mutex_unlock(&c->tcp_mutex); | 1551 | pthread_mutex_unlock(&c->tcp_mutex); |
1552 | 1552 | ||
1553 | if (conn->connection_number_tcp == -1) | 1553 | if (connection_number_tcp == -1) |
1554 | return -1; | 1554 | return -1; |
1555 | 1555 | ||
1556 | conn->connection_number_tcp = connection_number_tcp; | ||
1556 | memcpy(conn->public_key, n_c->public_key, crypto_box_PUBLICKEYBYTES); | 1557 | memcpy(conn->public_key, n_c->public_key, crypto_box_PUBLICKEYBYTES); |
1557 | memcpy(conn->recv_nonce, n_c->recv_nonce, crypto_box_NONCEBYTES); | 1558 | memcpy(conn->recv_nonce, n_c->recv_nonce, crypto_box_NONCEBYTES); |
1558 | memcpy(conn->peersessionpublic_key, n_c->peersessionpublic_key, crypto_box_PUBLICKEYBYTES); | 1559 | memcpy(conn->peersessionpublic_key, n_c->peersessionpublic_key, crypto_box_PUBLICKEYBYTES); |
@@ -1600,12 +1601,13 @@ int new_crypto_connection(Net_Crypto *c, const uint8_t *real_public_key, const u | |||
1600 | return -1; | 1601 | return -1; |
1601 | 1602 | ||
1602 | pthread_mutex_lock(&c->tcp_mutex); | 1603 | pthread_mutex_lock(&c->tcp_mutex); |
1603 | conn->connection_number_tcp = new_tcp_connection_to(c->tcp_c, dht_public_key, crypt_connection_id); | 1604 | int connection_number_tcp = new_tcp_connection_to(c->tcp_c, dht_public_key, crypt_connection_id); |
1604 | pthread_mutex_unlock(&c->tcp_mutex); | 1605 | pthread_mutex_unlock(&c->tcp_mutex); |
1605 | 1606 | ||
1606 | if (conn->connection_number_tcp == -1) | 1607 | if (connection_number_tcp == -1) |
1607 | return -1; | 1608 | return -1; |
1608 | 1609 | ||
1610 | conn->connection_number_tcp = connection_number_tcp; | ||
1609 | memcpy(conn->public_key, real_public_key, crypto_box_PUBLICKEYBYTES); | 1611 | memcpy(conn->public_key, real_public_key, crypto_box_PUBLICKEYBYTES); |
1610 | random_nonce(conn->sent_nonce); | 1612 | random_nonce(conn->sent_nonce); |
1611 | crypto_box_keypair(conn->sessionpublic_key, conn->sessionsecret_key); | 1613 | crypto_box_keypair(conn->sessionpublic_key, conn->sessionsecret_key); |