Fixed bad memcmp, activated receiving messages.

This commit is contained in:
n07070 2020-04-28 00:01:43 +02:00
parent 4539b8c3c7
commit a178c76116

View File

@ -832,7 +832,7 @@ int work_with_tlvs(char * data, int16_t total_packet_len, struct sockaddr_in6 *s
printf("\n"); printf("\n");
} }
if(memcmp(hash, cur_tlv.network_hash->network_hash, 16) == 0) { if(memcmp(hash, cur_tlv.network_hash->network_hash, 16) != 0) {
print_debug(">> Sending out our network hash."); print_debug(">> Sending out our network hash.");
build_network_state_req(&new_tlv); build_network_state_req(&new_tlv);
send_single_tlv(&new_tlv, sender, socket_num); send_single_tlv(&new_tlv, sender, socket_num);
@ -921,6 +921,10 @@ int work_with_tlvs(char * data, int16_t total_packet_len, struct sockaddr_in6 *s
print_debug(">> Received node state, updating..."); print_debug(">> Received node state, updating...");
cur_tlv.node_state = (node_state*) (data + pos); cur_tlv.node_state = (node_state*) (data + pos);
print_debug(">> Received message ! ");
if (DEBUG_LEVEL > 0) {
printf("\n\t %s \n", (char *) cur_tlv.node_state->data);
}
add_data(cur_tlv.node_state->length - 26, cur_tlv.node_state->node_id, cur_tlv.node_state->seqno, cur_tlv.node_state->data); add_data(cur_tlv.node_state->length - 26, cur_tlv.node_state->node_id, cur_tlv.node_state->seqno, cur_tlv.node_state->data);
// The position is updated // The position is updated