remove close from read/write methods

This commit is contained in:
Dmitriy Ryajov 2020-05-25 08:38:54 -06:00
parent 7a261ab103
commit d4f8680fe9
No known key found for this signature in database
GPG Key ID: DA8C680CE7C657A4

View File

@ -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
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
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
method atEof*(s: Connection): bool {.inline.} =
if isNil(s.stream):