Skip to content

Commit

Permalink
bugman fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayBlagoev committed Apr 18, 2024
1 parent 996f535 commit 9f59053
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions deccom/nodes/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ def __init__(self, p: Peer, protocol: AbstractProtocol, ip_addr = "0.0.0.0", por

async def listen(self):
loop = asyncio.get_running_loop()
listen = loop.create_datagram_endpoint(self.protocol_type.get_lowest, local_addr=(self.ip_addr, self.port))
self.transport, self.protocol = await listen
self.udp = loop.create_datagram_endpoint(self.protocol_type.get_lowest, local_addr=(self.ip_addr, self.port))
self.transport, self.protocol = await self.udp
await self.protocol_type.start(self.peer)
async def sendto(self, msg, addr):
await self.protocol_type.sendto(msg, addr=addr)
Expand Down
4 changes: 2 additions & 2 deletions deccom/protocols/delayprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ async def send_stream(self,node_id,data):
loop = asyncio.get_event_loop()
dl = self.delay_map(p.pub_key, self.peer.pub_key)
print(dl)
print("will send in ",dl[0]/1000 + 100*len(data)/(1024**3*dl[1]))
await asyncio.sleep(dl[0]/1000 + 100*len(data)/(1024**3*dl[1]))
print("will send in ",dl[0]/1000 + len(data)/(1024**3*dl[1]))
await asyncio.sleep(dl[0]/1000 + len(data)/(1024**3*dl[1]))
if self.started:
return await self._lower_send_to(node_id,data)
@bindto("send_stream")
Expand Down
1 change: 0 additions & 1 deletion deccom/protocols/streamprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ async def send_stream(self, node_id, data, lvl = 0):
with open(f"log{self.peer.pub_key}.txt", "a") as log:
log.write(datetime.now().strftime("%d/%m/%Y, %H:%M:%S"))
log.write(f" cannot send to {self.get_peer(node_id).pub_key} {len(data)}\n")
self.remove_from_dict(node_id)
await asyncio.sleep(3)
p: Peer = self.get_peer(node_id)
if p == None:
Expand Down

0 comments on commit 9f59053

Please sign in to comment.