pass exact size to recv

This commit is contained in:
Christian Ulrich 2020-08-23 16:11:53 +02:00
parent 239131eae5
commit af9dedf75a
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 2 additions and 2 deletions

View File

@ -228,7 +228,7 @@ proc runApp(serverHostname: string, serverPort: Port, peerId: string,
break break
echo "accepted!" echo "accepted!"
await sock.send("ping") await sock.send("ping")
let msg = await sock.recv(1000) let msg = await sock.recv(4)
echo "received message: ", msg echo "received message: ", msg
else: else:
@ -238,7 +238,7 @@ proc runApp(serverHostname: string, serverPort: Port, peerId: string,
asyncCheck handleServerMessages(serverConn) asyncCheck handleServerMessages(serverConn)
let sock = await punchHole(punchdConn, serverConn, peerId, otherPeerId) let sock = await punchHole(punchdConn, serverConn, peerId, otherPeerId)
echo "connected!" echo "connected!"
let msg = await sock.recv(1000) let msg = await sock.recv(4)
echo "received message: ", msg echo "received message: ", msg
await sock.send("pong") await sock.send("pong")