summaryrefslogtreecommitdiff
path: root/toxcore
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore')
-rw-r--r--toxcore/Messenger.c3
-rw-r--r--toxcore/TCP_server.c6
-rw-r--r--toxcore/TCP_server.h4
3 files changed, 6 insertions, 7 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index 381ee737..dccd6495 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -1813,8 +1813,7 @@ Messenger *new_messenger(Messenger_Options *options, unsigned int *error)
1813 } 1813 }
1814 1814
1815 if (options->tcp_server_port) { 1815 if (options->tcp_server_port) {
1816 m->tcp_server = new_TCP_server(options->ipv6enabled, 1, &options->tcp_server_port, m->dht->self_public_key, 1816 m->tcp_server = new_TCP_server(options->ipv6enabled, 1, &options->tcp_server_port, m->dht->self_secret_key, m->onion);
1817 m->dht->self_secret_key, m->onion);
1818 1817
1819 if (m->tcp_server == NULL) { 1818 if (m->tcp_server == NULL) {
1820 kill_friend_connections(m->fr_c); 1819 kill_friend_connections(m->fr_c);
diff --git a/toxcore/TCP_server.c b/toxcore/TCP_server.c
index f07df2c6..cf997d34 100644
--- a/toxcore/TCP_server.c
+++ b/toxcore/TCP_server.c
@@ -939,8 +939,8 @@ static sock_t new_listening_TCP_socket(int family, uint16_t port)
939 return sock; 939 return sock;
940} 940}
941 941
942TCP_Server *new_TCP_server(uint8_t ipv6_enabled, uint16_t num_sockets, const uint16_t *ports, const uint8_t *public_key, 942TCP_Server *new_TCP_server(uint8_t ipv6_enabled, uint16_t num_sockets, const uint16_t *ports, const uint8_t *secret_key,
943 const uint8_t *secret_key, Onion *onion) 943 Onion *onion)
944{ 944{
945 if (num_sockets == 0 || ports == NULL) 945 if (num_sockets == 0 || ports == NULL)
946 return NULL; 946 return NULL;
@@ -1015,8 +1015,8 @@ TCP_Server *new_TCP_server(uint8_t ipv6_enabled, uint16_t num_sockets, const uin
1015 set_callback_handle_recv_1(onion, &handle_onion_recv_1, temp); 1015 set_callback_handle_recv_1(onion, &handle_onion_recv_1, temp);
1016 } 1016 }
1017 1017
1018 memcpy(temp->public_key, public_key, crypto_box_PUBLICKEYBYTES);
1019 memcpy(temp->secret_key, secret_key, crypto_box_SECRETKEYBYTES); 1018 memcpy(temp->secret_key, secret_key, crypto_box_SECRETKEYBYTES);
1019 crypto_scalarmult_curve25519_base(temp->public_key, temp->secret_key);
1020 1020
1021 bs_list_init(&temp->accepted_key_list, crypto_box_PUBLICKEYBYTES, 8); 1021 bs_list_init(&temp->accepted_key_list, crypto_box_PUBLICKEYBYTES, 8);
1022 1022
diff --git a/toxcore/TCP_server.h b/toxcore/TCP_server.h
index ba3e7308..3f6b18ae 100644
--- a/toxcore/TCP_server.h
+++ b/toxcore/TCP_server.h
@@ -143,8 +143,8 @@ typedef struct {
143 143
144/* Create new TCP server instance. 144/* Create new TCP server instance.
145 */ 145 */
146TCP_Server *new_TCP_server(uint8_t ipv6_enabled, uint16_t num_sockets, const uint16_t *ports, const uint8_t *public_key, 146TCP_Server *new_TCP_server(uint8_t ipv6_enabled, uint16_t num_sockets, const uint16_t *ports, const uint8_t *secret_key,
147 const uint8_t *secret_key, Onion *onion); 147 Onion *onion);
148 148
149/* Run the TCP_server 149/* Run the TCP_server
150 */ 150 */