summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-06-28 22:14:54 -0400
committerirungentoo <irungentoo@gmail.com>2015-06-28 22:14:54 -0400
commit50e0802a62520fe0aceff9f4e6bb6d54f1bfa0b0 (patch)
tree8042086f5b9183f9a447da438fd9917c80f92077
parentb8362a6726c49ae53fa08846739f354b7b75ee13 (diff)
Removed useless parameter from new_TCP_server()
-rw-r--r--auto_tests/TCP_test.c6
-rw-r--r--other/DHT_bootstrap.c2
-rw-r--r--other/bootstrap_daemon/tox-bootstrapd.c3
-rw-r--r--toxcore/Messenger.c3
-rw-r--r--toxcore/TCP_server.c6
-rw-r--r--toxcore/TCP_server.h4
6 files changed, 11 insertions, 13 deletions
diff --git a/auto_tests/TCP_test.c b/auto_tests/TCP_test.c
index a03baf92..92205e52 100644
--- a/auto_tests/TCP_test.c
+++ b/auto_tests/TCP_test.c
@@ -32,7 +32,7 @@ START_TEST(test_basic)
32 uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; 32 uint8_t self_public_key[crypto_box_PUBLICKEYBYTES];
33 uint8_t self_secret_key[crypto_box_SECRETKEYBYTES]; 33 uint8_t self_secret_key[crypto_box_SECRETKEYBYTES];
34 crypto_box_keypair(self_public_key, self_secret_key); 34 crypto_box_keypair(self_public_key, self_secret_key);
35 TCP_Server *tcp_s = new_TCP_server(1, NUM_PORTS, ports, self_public_key, self_secret_key, NULL); 35 TCP_Server *tcp_s = new_TCP_server(1, NUM_PORTS, ports, self_secret_key, NULL);
36 ck_assert_msg(tcp_s != NULL, "Failed to create TCP relay server"); 36 ck_assert_msg(tcp_s != NULL, "Failed to create TCP relay server");
37 ck_assert_msg(tcp_s->num_listening_socks == NUM_PORTS, "Failed to bind to all ports"); 37 ck_assert_msg(tcp_s->num_listening_socks == NUM_PORTS, "Failed to bind to all ports");
38 38
@@ -214,7 +214,7 @@ START_TEST(test_some)
214 uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; 214 uint8_t self_public_key[crypto_box_PUBLICKEYBYTES];
215 uint8_t self_secret_key[crypto_box_SECRETKEYBYTES]; 215 uint8_t self_secret_key[crypto_box_SECRETKEYBYTES];
216 crypto_box_keypair(self_public_key, self_secret_key); 216 crypto_box_keypair(self_public_key, self_secret_key);
217 TCP_Server *tcp_s = new_TCP_server(1, NUM_PORTS, ports, self_public_key, self_secret_key, NULL); 217 TCP_Server *tcp_s = new_TCP_server(1, NUM_PORTS, ports, self_secret_key, NULL);
218 ck_assert_msg(tcp_s != NULL, "Failed to create TCP relay server"); 218 ck_assert_msg(tcp_s != NULL, "Failed to create TCP relay server");
219 ck_assert_msg(tcp_s->num_listening_socks == NUM_PORTS, "Failed to bind to all ports"); 219 ck_assert_msg(tcp_s->num_listening_socks == NUM_PORTS, "Failed to bind to all ports");
220 220
@@ -380,7 +380,7 @@ START_TEST(test_client)
380 uint8_t self_public_key[crypto_box_PUBLICKEYBYTES]; 380 uint8_t self_public_key[crypto_box_PUBLICKEYBYTES];
381 uint8_t self_secret_key[crypto_box_SECRETKEYBYTES]; 381 uint8_t self_secret_key[crypto_box_SECRETKEYBYTES];
382 crypto_box_keypair(self_public_key, self_secret_key); 382 crypto_box_keypair(self_public_key, self_secret_key);
383 TCP_Server *tcp_s = new_TCP_server(1, NUM_PORTS, ports, self_public_key, self_secret_key, NULL); 383 TCP_Server *tcp_s = new_TCP_server(1, NUM_PORTS, ports, self_secret_key, NULL);
384 ck_assert_msg(tcp_s != NULL, "Failed to create TCP relay server"); 384 ck_assert_msg(tcp_s != NULL, "Failed to create TCP relay server");
385 ck_assert_msg(tcp_s->num_listening_socks == NUM_PORTS, "Failed to bind to all ports"); 385 ck_assert_msg(tcp_s->num_listening_socks == NUM_PORTS, "Failed to bind to all ports");
386 386
diff --git a/other/DHT_bootstrap.c b/other/DHT_bootstrap.c
index 29aa5bcf..52e84315 100644
--- a/other/DHT_bootstrap.c
+++ b/other/DHT_bootstrap.c
@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
141#ifdef TCP_RELAY_ENABLED 141#ifdef TCP_RELAY_ENABLED
142#define NUM_PORTS 3 142#define NUM_PORTS 3
143 uint16_t ports[NUM_PORTS] = {443, 3389, PORT}; 143 uint16_t ports[NUM_PORTS] = {443, 3389, PORT};
144 TCP_Server *tcp_s = new_TCP_server(ipv6enabled, NUM_PORTS, ports, dht->self_public_key, dht->self_secret_key, onion); 144 TCP_Server *tcp_s = new_TCP_server(ipv6enabled, NUM_PORTS, ports, dht->self_secret_key, onion);
145 145
146 if (tcp_s == NULL) { 146 if (tcp_s == NULL) {
147 printf("TCP server failed to initialize.\n"); 147 printf("TCP server failed to initialize.\n");
diff --git a/other/bootstrap_daemon/tox-bootstrapd.c b/other/bootstrap_daemon/tox-bootstrapd.c
index 8b5e6a4b..267e7238 100644
--- a/other/bootstrap_daemon/tox-bootstrapd.c
+++ b/other/bootstrap_daemon/tox-bootstrapd.c
@@ -624,8 +624,7 @@ int main(int argc, char *argv[])
624 return 1; 624 return 1;
625 } 625 }
626 626
627 tcp_server = new_TCP_server(enable_ipv6, tcp_relay_port_count, tcp_relay_ports, dht->self_public_key, 627 tcp_server = new_TCP_server(enable_ipv6, tcp_relay_port_count, tcp_relay_ports, dht->self_secret_key, onion);
628 dht->self_secret_key, onion);
629 628
630 // tcp_relay_port_count != 0 at this point 629 // tcp_relay_port_count != 0 at this point
631 free(tcp_relay_ports); 630 free(tcp_relay_ports);
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 */