Skip to content

Commit

Permalink
cleanup frmtPushPromise leftovers
Browse files Browse the repository at this point in the history
  • Loading branch information
nitely committed Feb 5, 2025
1 parent 856e9e1 commit 4032d8a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/hyperx/clientserver.nim
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,6 @@ proc recvDispatcherNaked(client: ClientContext) {.async.} =
client.windowPending += frm.payloadLen.int
if frm.typ == frmtWindowUpdate:
check frm.windowSizeInc > 0, newConnError(hyxProtocolError)
if frm.typ == frmtPushPromise:
check client.typ == ctClient, newConnError(hyxProtocolError)
# Process headers even if the stream does not exist
if frm.sid notin client.streams:
if frm.typ == frmtData:
Expand Down Expand Up @@ -855,20 +853,21 @@ proc process(stream: Stream, frm: Frame) {.raises: [HyperxConnError, HyperxStrmE
doAssert frm.typ in frmStreamAllowed
# this can raise stream/conn error
stream.doTransitionRecv frm
if frm.typ == frmtRstStream:
case frm.typ
of frmtRstStream:
stream.error = newStrmError(frm.errCode, hyxRemoteErr)
stream.close()
raise newStrmError(frm.errCode, hyxRemoteErr)
if frm.typ == frmtPushPromise:
raise newStrmError hyxProtocolError
if frm.typ == frmtWindowUpdate:
of frmtWindowUpdate:
check frm.windowSizeInc > 0, newStrmError hyxProtocolError
check frm.windowSizeInc <= stgMaxWindowSize, newStrmError hyxProtocolError
check stream.peerWindow <= stgMaxWindowSize.int32 - frm.windowSizeInc.int32,
newStrmError hyxFlowControlError
stream.peerWindow += frm.windowSizeInc.int32
if not stream.peerWindowUpdateSig.isClosed:
stream.peerWindowUpdateSig.trigger()
else:
doAssert frm.typ in {frmtData, frmtHeaders}

# this needs to be {.async.} to fail-silently
proc writeRst(strm: ClientStream, code: FrmErrCode) {.async.} =
Expand Down

0 comments on commit 4032d8a

Please sign in to comment.