Loading src/quic.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -4724,6 +4724,33 @@ size_t quic::sendData(buffer& data, int flags) { sent_total += chunk; } // FIN-only: send an empty STREAM frame with FIN when there's no data // (e.g. sendStreamData(sid, nullptr, 0, true) after prior data sends). // The main loop doesn't execute when send_len == 0, so handle it here. if (send_len == 0 && fin && !stream.send_fin) { // Build STREAM frame: type=0x09 (FIN + no LEN), OFF bit if offset > 0 std::vector<uint8_t> stream_frame; uint8_t frame_type = 0x08 | 0x01; // FIN bit if (stream.send_offset > 0) frame_type |= 0x04; // OFF bit stream_frame.push_back(frame_type); uint8_t vbuf[8]; size_t vlen = encodeVarInt(stream_id, vbuf); stream_frame.insert(stream_frame.end(), vbuf, vbuf + vlen); if (stream.send_offset > 0) { vlen = encodeVarInt(stream.send_offset, vbuf); stream_frame.insert(stream_frame.end(), vbuf, vbuf + vlen); } // No data, no LEN — just the FIN flag uint64_t pn_before = _app_pn_send; std::vector<uint8_t> packet = buildShortHeaderPacket(stream_frame); const uint8_t* hp_key = _is_server ? _app_hp_server : _app_hp_client; applyHeaderProtection(packet, hp_key); sendPacket(packet.data(), packet.size()); recordSentPacket(pn_before, stream_id, stream.send_offset, nullptr, 0, true); stream.send_fin = true; } return sent_total; } Loading Loading
src/quic.cpp +27 −0 Original line number Diff line number Diff line Loading @@ -4724,6 +4724,33 @@ size_t quic::sendData(buffer& data, int flags) { sent_total += chunk; } // FIN-only: send an empty STREAM frame with FIN when there's no data // (e.g. sendStreamData(sid, nullptr, 0, true) after prior data sends). // The main loop doesn't execute when send_len == 0, so handle it here. if (send_len == 0 && fin && !stream.send_fin) { // Build STREAM frame: type=0x09 (FIN + no LEN), OFF bit if offset > 0 std::vector<uint8_t> stream_frame; uint8_t frame_type = 0x08 | 0x01; // FIN bit if (stream.send_offset > 0) frame_type |= 0x04; // OFF bit stream_frame.push_back(frame_type); uint8_t vbuf[8]; size_t vlen = encodeVarInt(stream_id, vbuf); stream_frame.insert(stream_frame.end(), vbuf, vbuf + vlen); if (stream.send_offset > 0) { vlen = encodeVarInt(stream.send_offset, vbuf); stream_frame.insert(stream_frame.end(), vbuf, vbuf + vlen); } // No data, no LEN — just the FIN flag uint64_t pn_before = _app_pn_send; std::vector<uint8_t> packet = buildShortHeaderPacket(stream_frame); const uint8_t* hp_key = _is_server ? _app_hp_server : _app_hp_client; applyHeaderProtection(packet, hp_key); sendPacket(packet.data(), packet.size()); recordSentPacket(pn_before, stream_id, stream.send_offset, nullptr, 0, true); stream.send_fin = true; } return sent_total; } Loading