Add hasDataBuffered to asyncnet (#16000)

Co-authored-by: flywind <xzsflywind@gmail.com>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
This commit is contained in:
Dylan Modesitt
2021-03-29 19:12:58 -04:00
committed by GitHub
parent ed126794b6
commit 35655cd189
2 changed files with 7 additions and 0 deletions

View File

@@ -246,6 +246,8 @@
- Added dollar `$` and `len` for `jsre.RegExp`.
- Added `hasDataBuffered` to `asyncnet`.
- Added `hasClosure` to `std/typetraits`.

View File

@@ -650,6 +650,11 @@ proc bindAddr*(socket: AsyncSocket, port = Port(0), address = "") {.
raiseOSError(osLastError())
freeaddrinfo(aiList)
proc hasDataBuffered*(s: AsyncSocket): bool {.since: (1, 5).} =
## Determines whether an AsyncSocket has data buffered.
# xxx dedup with std/net
s.isBuffered and s.bufLen > 0 and s.currPos != s.bufLen
when defined(posix):
proc connectUnix*(socket: AsyncSocket, path: string): owned(Future[void]) =