add 50ms simulated network latency

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2023-05-11 01:23:38 +02:00
parent 23733c13c8
commit ba0d671e51
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E

View File

@ -48,6 +48,7 @@ when(true): #enable network emulator
proc sendTo*[T](transp: DatagramTransport, remote: TransportAddress,
msg: sink seq[T], msglen = -1) {.async.} =
#echo "sending to ", remote
await sleepAsync(50.milliseconds)
{.gcsafe.}:
network[remote.port].recvFrom(transp.local, msg)