Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise on recv canceled #29

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/hyperx/clientserver.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ proc recvHeaders*(strm: ClientStream, data: ref string) {.async.} =
proc recvBodyNaked(strm: ClientStream, data: ref string) {.async.} =
template client: untyped = strm.client
template stream: untyped = strm.stream
if strm.stateRecv != csStateEnded and strm.bodyRecv.len == 0:
if strm.bodyRecv.len == 0:
await strm.bodyRecvSig.waitFor()
let bodyL = strm.bodyRecvLen
data[].add strm.bodyRecv
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/tcancelremote.nim
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ proc send(strm: ClientStream) {.async.} =
finish = false
)
let data = newStringRef newString(dataFrameLen)
while true:
while true: # until server cancel
await strm.sendBody(data, finish = false)

proc recv(strm: ClientStream) {.async.} =
var data = newStringref()
await strm.recvHeaders(data)
doAssert data[] == ":status: 200\r\n"
data[].setLen 0
while not strm.recvEnded:
while true: # until server cancel
await strm.recvBody(data)
doAssert data[].len == 0

Expand Down
Loading