summaryrefslogtreecommitdiff
path: root/toxcore/Messenger.c
diff options
context:
space:
mode:
Diffstat (limited to 'toxcore/Messenger.c')
-rw-r--r--toxcore/Messenger.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c
index c96a330f..945d6556 100644
--- a/toxcore/Messenger.c
+++ b/toxcore/Messenger.c
@@ -3140,13 +3140,14 @@ static uint8_t *save_tcp_relays(const Messenger *m, uint8_t *data)
3140 Node_format relays[NUM_SAVED_TCP_RELAYS]; 3140 Node_format relays[NUM_SAVED_TCP_RELAYS];
3141 uint8_t *temp_data = data; 3141 uint8_t *temp_data = data;
3142 data = state_write_section_header(temp_data, STATE_COOKIE_TYPE, 0, STATE_TYPE_TCP_RELAY); 3142 data = state_write_section_header(temp_data, STATE_COOKIE_TYPE, 0, STATE_TYPE_TCP_RELAY);
3143 uint32_t num = copy_connected_tcp_relays(m->net_crypto, relays, NUM_SAVED_TCP_RELAYS);
3144 3143
3145 if (m->num_loaded_relays > 0) { 3144 if (m->num_loaded_relays > 0) {
3146 memcpy(relays, m->loaded_relays, sizeof(Node_format) * m->num_loaded_relays); 3145 memcpy(relays, m->loaded_relays, sizeof(Node_format) * m->num_loaded_relays);
3147 num = min_u32(num + m->num_loaded_relays, NUM_SAVED_TCP_RELAYS);
3148 } 3146 }
3149 3147
3148 uint32_t num = m->num_loaded_relays;
3149 num += copy_connected_tcp_relays(m->net_crypto, relays + num, NUM_SAVED_TCP_RELAYS - num);
3150
3150 int l = pack_nodes(data, NUM_SAVED_TCP_RELAYS * packed_node_size(net_family_tcp_ipv6), relays, num); 3151 int l = pack_nodes(data, NUM_SAVED_TCP_RELAYS * packed_node_size(net_family_tcp_ipv6), relays, num);
3151 3152
3152 if (l > 0) { 3153 if (l > 0) {