summaryrefslogtreecommitdiff
path: root/core/DHT.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2013-06-27 07:37:06 -0400
committerirungentoo <irungentoo@gmail.com>2013-06-27 07:37:06 -0400
commitd0ed1639144a5f3358d8bc69ad0885d0c1133877 (patch)
tree237e58d3314875939ccd20641a55fb0bfa2d4237 /core/DHT.c
parent0068d370ffdb33fe62ab20f3e4654463f469724c (diff)
Fixed something in the DHT, added a milisecond time function.
Diffstat (limited to 'core/DHT.c')
-rw-r--r--core/DHT.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/DHT.c b/core/DHT.c
index d7299100..05d9d20c 100644
--- a/core/DHT.c
+++ b/core/DHT.c
@@ -713,10 +713,10 @@ void doFriends()
713 { 713 {
714 if(friends_list[i].client_list[j].timestamp + Kill_NODE_TIMEOUT > temp_time)//if node is not dead. 714 if(friends_list[i].client_list[j].timestamp + Kill_NODE_TIMEOUT > temp_time)//if node is not dead.
715 { 715 {
716 //TODO: Make this better, it only works if the function is called more than once per second. 716 if((friends_list[i].client_list[j].last_pinged + PING_INTERVAL) <= temp_time)
717 if((temp_time - friends_list[i].client_list[j].timestamp) % PING_INTERVAL == 0)
718 { 717 {
719 pingreq(friends_list[i].client_list[j].ip_port); 718 pingreq(friends_list[i].client_list[j].ip_port);
719 friends_list[i].client_list[j].last_pinged = temp_time;
720 } 720 }
721 if(friends_list[i].client_list[j].timestamp + BAD_NODE_TIMEOUT > temp_time)//if node is good. 721 if(friends_list[i].client_list[j].timestamp + BAD_NODE_TIMEOUT > temp_time)//if node is good.
722 { 722 {
@@ -751,10 +751,10 @@ void doClose()//tested
751 { 751 {
752 if(close_clientlist[i].timestamp + Kill_NODE_TIMEOUT > temp_time)//if node is not dead. 752 if(close_clientlist[i].timestamp + Kill_NODE_TIMEOUT > temp_time)//if node is not dead.
753 { 753 {
754 //TODO: Make this better, it only works if the function is called more than once per second. 754 if((close_clientlist[i].last_pinged + PING_INTERVAL) <= temp_time)
755 if((temp_time - close_clientlist[i].timestamp) % PING_INTERVAL == 0)
756 { 755 {
757 pingreq(close_clientlist[i].ip_port); 756 pingreq(close_clientlist[i].ip_port);
757 close_clientlist[i].last_pinged = temp_time;
758 } 758 }
759 if(close_clientlist[i].timestamp + BAD_NODE_TIMEOUT > temp_time)//if node is good. 759 if(close_clientlist[i].timestamp + BAD_NODE_TIMEOUT > temp_time)//if node is good.
760 { 760 {