Modifications pour faire le message toutes les 20 secondes

This commit is contained in:
N07070 2020-03-13 14:46:24 +01:00
parent 2b9e67e627
commit f625058a3c

View File

@ -53,6 +53,8 @@ void work_with_tlvs(struct tlvs_list receivied_tlvs){
int main(int argc, char const *argv[]) { int main(int argc, char const *argv[]) {
while(CONTINUE){
// We create the neighbourhood table // We create the neighbourhood table
// We create the message table // We create the message table
// We create our own message. // We create our own message.
@ -70,7 +72,8 @@ int main(int argc, char const *argv[]) {
// We then look at the differents TLVs in the packet. // We then look at the differents TLVs in the packet.
work_with_tlvs(); work_with_tlvs();
time_t delay = time(NULL) + 20;
while(! (delay < time(NULL)){
// Theses functions are there for general book-keeping,and run in there own // Theses functions are there for general book-keeping,and run in there own
// thread, being run every 20 seconds. // thread, being run every 20 seconds.
// Every 20 sec, if we have less than 5 neighbours, we ask for more peers // Every 20 sec, if we have less than 5 neighbours, we ask for more peers
@ -81,5 +84,7 @@ int main(int argc, char const *argv[]) {
t_update_neighbours(); t_update_neighbours();
// We send out a TLV Network hash to get an ideal of the network state. // We send out a TLV Network hash to get an ideal of the network state.
t_get_network_state(); t_get_network_state();
}
}
return 0; return 0;
} }