From 71640da8f2defc069f0b231f93a6de4a79e246b0 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Mon, 25 May 2020 08:38:54 -0600 Subject: [PATCH] remove close from read/write methods --- libp2p/connection.nim | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/libp2p/connection.nim b/libp2p/connection.nim index c8e625f6b..5f822328a 100644 --- a/libp2p/connection.nim +++ b/libp2p/connection.nim @@ -86,30 +86,18 @@ method readExactly*(s: Connection, pbytes: pointer, nbytes: int): Future[void] {.async, gcsafe.} = - try: - await s.stream.readExactly(pbytes, nbytes) - except CatchableError as exc: - await s.close() - raise exc + await s.stream.readExactly(pbytes, nbytes) method readOnce*(s: Connection, pbytes: pointer, nbytes: int): Future[int] {.async, gcsafe.} = - try: - result = await s.stream.readOnce(pbytes, nbytes) - except CatchableError as exc: - await s.close() - raise exc + result = await s.stream.readOnce(pbytes, nbytes) method write*(s: Connection, msg: seq[byte]): Future[void] {.async, gcsafe.} = - try: - await s.stream.write(msg) - except CatchableError as exc: - await s.close() - raise exc + await s.stream.write(msg) method atEof*(s: Connection): bool {.inline.} = if isNil(s.stream):