small cleanup

This commit is contained in:
Dmitriy Ryajov 2020-04-04 20:43:05 -06:00
parent 8dda6c289d
commit bae4713a85
1 changed files with 16 additions and 15 deletions

View File

@ -16,6 +16,7 @@ import ../../peer
import ../../peerinfo
import ../../protobuf/minprotobuf
import ../../utility
import ../../stream/lpstream
import secure,
../../crypto/[crypto, chacha20poly1305, curve25519, hkdf],
../../stream/bufferstream
@ -426,9 +427,9 @@ method readMessage(sconn: NoiseConnection): Future[seq[byte]] {.async.} =
var plain = sconn.readCs.decryptWithAd([], cipher)
unpackNoisePayload(plain)
return plain
except AsyncStreamIncompleteError:
except LPStreamIncompleteError:
trace "Connection dropped while reading"
except AsyncStreamReadError:
except LPStreamReadError:
trace "Error reading from connection"
method writeMessage(sconn: NoiseConnection, message: seq[byte]): Future[void] {.async.} =
@ -508,7 +509,7 @@ method handshake*(p: Noise, conn: Connection, initiator: bool = false): Future[S
secure.readCs = handshakeRes.cs1
secure.writeCs = handshakeRes.cs2
debug "Noise handshake completed!"
trace "Noise handshake completed!"
return secure