diff options
author | Dominik Picheta <dominikpicheta@gmail.com> | 2018-01-17 16:28:00 +0000 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@gmail.com> | 2018-01-17 16:28:00 +0000 |
commit | 47d05b3f2e9e9d3ca3c5050981f373a40c1533c1 (patch) | |
tree | 14691cf79166b9e2db7a014fb73fffdf1443fb02 /lib/pure/asyncnet.nim | |
parent | 5e43e0d789a27f9e3635d5ac4644cb20769985b2 (diff) | |
parent | 399c5e38b7bf7a0998ca9ed4bce57c7092d59229 (diff) | |
download | Nim-47d05b3f2e9e9d3ca3c5050981f373a40c1533c1.tar.gz |
Merge branch 'devel' into async-improvements
Diffstat (limited to 'lib/pure/asyncnet.nim')
-rw-r--r-- | lib/pure/asyncnet.nim | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/pure/asyncnet.nim b/lib/pure/asyncnet.nim index 650bb3340..adee34b9e 100644 --- a/lib/pure/asyncnet.nim +++ b/lib/pure/asyncnet.nim @@ -286,6 +286,7 @@ template readInto(buf: pointer, size: int, socket: AsyncSocket, flags: set[SocketFlag]): int = ## Reads **up to** ``size`` bytes from ``socket`` into ``buf``. Note that ## this is a template and not a proc. + assert(not socket.closed, "Cannot `recv` on a closed socket") var res = 0 if socket.isSsl: when defineSsl: @@ -412,6 +413,7 @@ proc send*(socket: AsyncSocket, buf: pointer, size: int, ## Sends ``size`` bytes from ``buf`` to ``socket``. The returned future will complete once all ## data has been sent. assert socket != nil + assert(not socket.closed, "Cannot `send` on a closed socket") if socket.isSsl: when defineSsl: sslLoop(socket, flags, |