mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 20:17:42 +00:00
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:
@@ -246,6 +246,8 @@
|
||||
|
||||
- Added dollar `$` and `len` for `jsre.RegExp`.
|
||||
|
||||
- Added `hasDataBuffered` to `asyncnet`.
|
||||
|
||||
- Added `hasClosure` to `std/typetraits`.
|
||||
|
||||
|
||||
|
||||
@@ -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]) =
|
||||
|
||||
Reference in New Issue
Block a user