summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.c
diff options
context:
space:
mode:
authoriphydf <iphydf@users.noreply.github.com>2018-02-27 01:07:46 +0000
committeriphydf <iphydf@users.noreply.github.com>2018-05-20 19:35:28 +0000
commit21675ce0d2581597b0e0a727ab4cf6cfb796a037 (patch)
treee1ac4ca63c5cc2b2dc78fcd5b20a8202eab98d9d /toxcore/Messenger.c
parent4f6ab0708c85f3e3da7726f6caecc381c6d21370 (diff)
Finish @Diadlo's network Family abstraction.
The Family stuff in toxcore is a big mess. I'm sure I saw a bunch of bugs on the way, but I'm not verifying that code now, so the bugs stay.
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r--toxcore/Messenger.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index c381db0c..11109815 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -2599,7 +2599,7 @@ void do_messenger(Messenger *m, void *userdata)
2599 /* Add self tcp server. */ 2599 /* Add self tcp server. */
2600 IP_Port local_ip_port; 2600 IP_Port local_ip_port;
2601 local_ip_port.port = m->options.tcp_server_port; 2601 local_ip_port.port = m->options.tcp_server_port;
2602 local_ip_port.ip.family = TOX_AF_INET; 2602 local_ip_port.ip.family = net_family_ipv4;
2603 local_ip_port.ip.ip.v4 = get_ip4_loopback(); 2603 local_ip_port.ip.ip.v4 = get_ip4_loopback();
2604 add_tcp_relay(m->net_crypto, local_ip_port, 2604 add_tcp_relay(m->net_crypto, local_ip_port,
2605 tcp_server_public_key(m->tcp_server)); 2605 tcp_server_public_key(m->tcp_server));
@@ -2970,8 +2970,8 @@ uint32_t messenger_size(const Messenger *m)
2970 + sizesubhead + m->name_length // Own nickname. 2970 + sizesubhead + m->name_length // Own nickname.
2971 + sizesubhead + m->statusmessage_length // status message 2971 + sizesubhead + m->statusmessage_length // status message
2972 + sizesubhead + 1 // status 2972 + sizesubhead + 1 // status
2973 + sizesubhead + NUM_SAVED_TCP_RELAYS * packed_node_size(TCP_INET6) //TCP relays 2973 + sizesubhead + NUM_SAVED_TCP_RELAYS * packed_node_size(net_family_tcp_ipv6) //TCP relays
2974 + sizesubhead + NUM_SAVED_PATH_NODES * packed_node_size(TCP_INET6) //saved path nodes 2974 + sizesubhead + NUM_SAVED_PATH_NODES * packed_node_size(net_family_tcp_ipv6) //saved path nodes
2975 + sizesubhead; 2975 + sizesubhead;
2976} 2976}
2977 2977
@@ -3041,7 +3041,7 @@ void messenger_save(const Messenger *m, uint8_t *data)
3041 uint8_t *temp_data = data; 3041 uint8_t *temp_data = data;
3042 data = messenger_save_subheader(temp_data, 0, type); 3042 data = messenger_save_subheader(temp_data, 0, type);
3043 unsigned int num = copy_connected_tcp_relays(m->net_crypto, relays, NUM_SAVED_TCP_RELAYS); 3043 unsigned int num = copy_connected_tcp_relays(m->net_crypto, relays, NUM_SAVED_TCP_RELAYS);
3044 int l = pack_nodes(data, NUM_SAVED_TCP_RELAYS * packed_node_size(TCP_INET6), relays, num); 3044 int l = pack_nodes(data, NUM_SAVED_TCP_RELAYS * packed_node_size(net_family_tcp_ipv6), relays, num);
3045 3045
3046 if (l > 0) { 3046 if (l > 0) {
3047 len = l; 3047 len = l;
@@ -3055,7 +3055,7 @@ void messenger_save(const Messenger *m, uint8_t *data)
3055 data = messenger_save_subheader(data, 0, type); 3055 data = messenger_save_subheader(data, 0, type);
3056 memset(nodes, 0, sizeof(nodes)); 3056 memset(nodes, 0, sizeof(nodes));
3057 num = onion_backup_nodes(m->onion_c, nodes, NUM_SAVED_PATH_NODES); 3057 num = onion_backup_nodes(m->onion_c, nodes, NUM_SAVED_PATH_NODES);
3058 l = pack_nodes(data, NUM_SAVED_PATH_NODES * packed_node_size(TCP_INET6), nodes, num); 3058 l = pack_nodes(data, NUM_SAVED_PATH_NODES * packed_node_size(net_family_tcp_ipv6), nodes, num);
3059 3059
3060 if (l > 0) { 3060 if (l > 0) {
3061 len = l; 3061 len = l;