Implement modules.
This commit is contained in:
parent
6be67a1916
commit
1c7138e499
6 changed files with 164 additions and 15 deletions
|
@ -6,8 +6,12 @@ from hypercorn.asyncio import serve
|
|||
from peerix.app import app
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
def run():
|
||||
uvloop.install()
|
||||
config = Config()
|
||||
config.bind = ["0.0.0.0:12304"]
|
||||
asyncio.run(serve(app, config))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run()
|
||||
|
|
|
@ -104,7 +104,9 @@ class DiscoveryProtocol(asyncio.DatagramProtocol, Store):
|
|||
self.transport.sendto(b"".join([b"\x00", idx.to_bytes(4, "big"), hsh.encode("utf-8")]), (addr, self.local_port))
|
||||
|
||||
try:
|
||||
port, url, addr = await asyncio.wait_for(fut, 0.5)
|
||||
# This must have a short timeout so it does not noticably slow down
|
||||
# querying of other caches.
|
||||
port, url, addr = await asyncio.wait_for(fut, 0.05)
|
||||
except asyncio.TimeoutError:
|
||||
print(f"No response for {hsh}")
|
||||
return None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue