txlyre 2 anos atrás
pai
commit
5af972aec9
1 arquivos alterados com 5 adições e 3 exclusões
  1. 5 3
      byafn.py

+ 5 - 3
byafn.py

@@ -41,7 +41,7 @@ MAX_DISTANCE      = 8
 MAX_PAYLOAD_SIZE  = 1024*1024*64
 CHUNK_SIZE        = 512
 
-RATELIMIT         = 0.25
+RATELIMIT         = 0.5
 
 config = {}
 
@@ -218,7 +218,7 @@ async def send(peer, message):
     async with peer.send_lock:
       await write(peer, buffer)
 
-      await asyncio.sleep(RATELIMIT*2)
+      await asyncio.sleep(RATELIMIT)
 
     return
 
@@ -253,7 +253,7 @@ async def send(peer, message):
           chunk
         )
 
-    await asyncio.sleep(RATELIMIT*2)
+    await asyncio.sleep(RATELIMIT)
 
 async def receive(peer):
   async with peer.receive_lock:
@@ -544,6 +544,8 @@ async def serve(peer):
     timeout=HANDSHAKE_TIMEOUT
   )
 
+  await asyncio.sleep(RATELIMIT)
+
   asyncio.get_event_loop().create_task(
     tick(peer)
   )