add closed() procedure to check if transport is closed.
This commit is contained in:
parent
aa15313aa8
commit
693783b36b
|
@ -665,3 +665,7 @@ proc getMessage*(transp: DatagramTransport): seq[byte] =
|
|||
proc getUserData*[T](transp: DatagramTransport): T {.inline.} =
|
||||
## Obtain user data stored in ``transp`` object.
|
||||
result = cast[T](transp.udata)
|
||||
|
||||
proc closed*(transp: DatagramTransport): bool {.inline.} =
|
||||
## Returns ``true`` if transport in closed state.
|
||||
result = ({ReadClosed, WriteClosed} * transp.state != {})
|
||||
|
|
|
@ -1213,3 +1213,7 @@ proc close*(transp: StreamTransport) =
|
|||
transp.state.incl({WriteClosed, ReadClosed})
|
||||
transp.future.complete()
|
||||
GC_unref(transp)
|
||||
|
||||
proc closed*(transp: StreamTransport): bool {.inline.} =
|
||||
## Returns ``true`` if transport in closed state.
|
||||
result = ({ReadClosed, WriteClosed} * transp.state != {})
|
||||
|
|
Loading…
Reference in New Issue