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

socketwait class added

parent 454d8cbd
Loading
Loading
Loading
Loading
+15 −0
Changes for src/quic.cpp: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2449,6 +2449,21 @@ size_t quic::recvData(buffer& data, int flags) {
    return result;
}

// ============================================================================
// Pump Network: read and process QUIC packets without consuming stream data.
// For use by HTTP/3 clients that read specific streams via recvStreamData().
// ============================================================================

void quic::pumpNetwork(int flags) {
    int recv_flags = (flags & MSG_DONTWAIT) ? MSG_DONTWAIT : 0;
    buffer recv_buf(65535);
    size_t recv_len = udp::recvData(recv_buf, recv_flags);
    if (recv_len > 0) {
        std::lock_guard<std::mutex> lock(_quic_mutex);
        processIncomingPacket(reinterpret_cast<const uint8_t*>(recv_buf.data.buf), recv_len);
    }
}

// ============================================================================
// Stream Data Receive (for specific stream)
// ============================================================================
+5 −0
Changes for src/socket.h: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -574,6 +574,11 @@ namespace netplus {
		bool hasStreamData(uint64_t stream_id) const;
		bool isStreamComplete(uint64_t stream_id) const;

		// Read raw UDP datagrams and process QUIC packets without consuming
		// stream data.  Use this in HTTP/3 client loops to pump the network
		// while reading specific streams via recvStreamData().
		void pumpNetwork(int flags = 0);

		// Connection ID management
		const std::vector<uint8_t>& getLocalConnectionId() const { return _local_cid; }
		const std::vector<uint8_t>& getRemoteConnectionId() const { return _remote_cid; }