This commit is contained in:
gonzalef 2020-04-28 17:47:56 +02:00
commit b7b786c69a
2 changed files with 6 additions and 5 deletions

View File

@ -802,6 +802,7 @@ int work_with_tlvs(char * data, int16_t total_packet_len, struct sockaddr_in6 *s
new_neighbour.sin6_scope_id = ifindex;
// Build network hash
// memset(&new_tlv,0,sizeof(struct network_hash));
build_network_hash(&new_tlv, data_list);
send_single_tlv(&new_tlv, &new_neighbour, socket_num);
@ -819,13 +820,13 @@ int work_with_tlvs(char * data, int16_t total_packet_len, struct sockaddr_in6 *s
if (DEBUG_LEVEL > 1) {
printf("\x1b[31m[DEBUG]\x1b[0m >> Our hash : ");
for(int x = 0; x < SHA256_DIGEST_LENGTH; x++){
for(int x = 0; x < 16; x++){
printf("%02x", hash[x]);
fflush(0);
}
printf("\n");
printf("\x1b[31m[DEBUG]\x1b[0m >> Received : ");
for(int x = 0; x < SHA256_DIGEST_LENGTH; x++){
for(int x = 0; x < 16; x++){
printf("%02x", cur_tlv.network_hash->network_hash[x]);
fflush(0);
}
@ -923,7 +924,7 @@ int work_with_tlvs(char * data, int16_t total_packet_len, struct sockaddr_in6 *s
print_debug(">> Received message ! ");
if (DEBUG_LEVEL > 0) {
printf("\n\t %s \n", (char *) cur_tlv.node_state->data);
printf("\nID : %li \nSeqno : %i\n “%s” \n", cur_tlv.node_state->node_id, cur_tlv.node_state->seqno, (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);
@ -1048,7 +1049,7 @@ int run_node(int sock_fd){
t_ask_for_more_peers(sock_fd);
t_update_neighbours();
t_get_network_state(sock_fd);
delay = time(NULL) + 20 + (rand() % 10);
delay = time(NULL) + 20 + (rand() % 5);
}
// This might be cool to add, but we need to find a way to write to stdin

View File

@ -62,7 +62,7 @@ typedef struct list {
// The adress of the main peer
#define ROOT_PEER_ADDR "2001:660:3301:9200::51c2:1b9b"
// fonctions signatures
int listen_for_packets(char * received_data_buffer, int received_data_len, struct sockaddr_in6 * sender, int sock_fd);