Commit d344bbc5 authored by jan.koester's avatar jan.koester
Browse files

test

parent 238b78e0
Loading
Loading
Loading
Loading
+19 −20
Original line number Diff line number Diff line
@@ -2944,11 +2944,7 @@ void quic::processFrame(const uint8_t* data, size_t len, size_t& offset) {
                    it->second.recv_fin_offset = final_size;
                }
                (void)app_error;
                // Deliberately not retired here: the application may still
                // need to observe this via isStreamReset()/hasStreamData()
                // before it's done with the stream. It retires (and, for a
                // peer-initiated stream, grants fresh credit) once the app
                // calls closeStream(), same as any other completed stream.
                retireStreamIfDone(sid);
            }
            break;

@@ -2960,17 +2956,16 @@ void quic::processFrame(const uint8_t* data, size_t len, size_t& offset) {
                uint64_t app_error = decodeVarInt(&data[offset], bytes);
                offset += bytes;
                auto it = _streams.find(sid);
                if (it != _streams.end() && !it->second.send_fin) {
                    // RFC 9000 §3.5: reset our send side in response so the
                    // peer isn't left waiting on a response it already told
                    // us it doesn't want. This is what lets retirement (and
                    // the peer's stream-count credit) happen promptly
                    // instead of only once our send finishes naturally,
                    // which for an abandoned/redundant fetch may be slow or
                    // never happen at all. resetStream() retires this side
                    // itself once both directions are terminal.
                if (it != _streams.end()) {
                    // RFC 9000 §3.5: reset the stream in response so the
                    // peer can see our send side as done and retire it
                    // promptly, instead of waiting on a response it already
                    // told us it doesn't want.
                    if (!it->second.send_fin) {
                        resetStream(sid, app_error);
                    }
                    retireStreamIfDone(sid);
                }
            }
            break;
            
@@ -3581,11 +3576,15 @@ void quic::processStreamFrame(const uint8_t* data, size_t len, size_t& offset) {
            stream.recv_ranges.clear();
        }
    }
    // Deliberately not retired here even once has_fin is set: the
    // application (client polling via hasStreamData/recvStreamData, or a
    // server callback not yet dispatched) may still need this stream's
    // buffered data. It retires once the app calls closeStream(), same as
    // any other completed stream.

    // The peer's FIN just arrived on this stream. If our own side already
    // finished sending (send_fin set earlier via closeStream/resetStream),
    // this is the event that completes the pair — retire it now instead of
    // relying on the local application to call closeStream() again for a
    // stream it may already consider done.
    if (has_fin) {
        retireStreamIfDone(stream_id);
    }
}

// ============================================================================