txlyre 2 years ago
parent
commit
6126ffbf07
1 changed files with 10 additions and 12 deletions
  1. 10 12
      byafn.py

+ 10 - 12
byafn.py

@@ -499,21 +499,19 @@ async def broadcast(message, message_filter=None, peer_filter=None):
 
 async def tick(peer):
   while peer.is_open:
-    if peer.ticks > 0 and peer.ticks % 3 == 0:
-      attempts = PINGS_COUNT
-      while True:
-        try:
-          await ping(peer)
-        except:        
-          attempts -= 1
-          if attempts < 1:
-            self.close(False)
+    attempts = PINGS_COUNT
 
-            return
+    while True:
+      try:
+        await ping(peer)
+      except:        
+        attempts -= 1
+        if attempts < 1:
+          self.close(False)
 
-        break
+          return
 
-    peer.ticks += 1
+      break
 
     await asyncio.sleep(HEARTBEAT)