Skip to content

Commit

Permalink
ignore size in delayer
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayBlagoev committed Apr 29, 2024
1 parent 51e033f commit b451cb8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions deccom/protocols/delayprotocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@ def __init__(self, delay_map, submodule=None, callback: Callable[[tuple[str, int


#self.stream_callback(data,node_id,addr)
async def send_stream(self,node_id,data):
async def send_stream(self,node_id,data, ignore_sz = 0):
print("delay...")
p = self.get_peer(node_id)
print(p)
loop = asyncio.get_event_loop()
dl = self.delay_map(p.pub_key, self.peer.pub_key)
sz = len(data) - ignore_sz
print(dl)
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]))
print("will send in ",dl[0]/1000 + sz/(1024**3*dl[1]))
await asyncio.sleep(dl[0]/1000 + sz/(1024**3*dl[1]))
if self.started:
return await self._lower_send_to(node_id,data)
@bindto("send_stream")
Expand Down

0 comments on commit b451cb8

Please sign in to comment.