mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
4d83f5bd45
- [BUGFIX] http_client: make sure only one read per on_read() callback is performed in the header conversion bypass (-B) mode. - http_client: with -E, assign random priority when stream is created. - [OPTIMIZATION] On immediate write, place an ACK frame into the first buffered packet if an ACK is queued. This reduces the number of standalone ACK packets. - [OPTIMIZATION] Allow placing more than one STREAM frame from the same stream into an outgoing packet. This change minimizes the number of buffered packets required to store several small HTTP messages by virtue of allowing more than one STREAM frame from HEADERS stream in the same packet. - [OPTIMIZATION] Flush headers when writing to buffered packets. This causes the headers to be written to the same buffered packet queue, thereby improving packet utilization, especially for small HTTP messages.
96 lines
3.1 KiB
C
96 lines
3.1 KiB
C
/* Copyright (c) 2017 - 2019 LiteSpeed Technologies Inc. See LICENSE. */
|
|
#include <assert.h>
|
|
#include <errno.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/queue.h>
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#ifndef WIN32
|
|
#include <unistd.h>
|
|
#endif
|
|
#include <fcntl.h>
|
|
|
|
#include <openssl/md5.h>
|
|
|
|
#include "lsquic.h"
|
|
|
|
#include "lsquic_int_types.h"
|
|
#include "lsquic_packet_common.h"
|
|
#include "lsquic_packet_out.h"
|
|
#include "lsquic_conn_flow.h"
|
|
#include "lsquic_sfcw.h"
|
|
#include "lsquic_stream.h"
|
|
#include "lsquic_types.h"
|
|
#include "lsquic_malo.h"
|
|
#include "lsquic_mm.h"
|
|
#include "lsquic_engine_public.h"
|
|
#include "lsquic_logger.h"
|
|
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
struct lsquic_engine_public enpub;
|
|
struct packet_out_srec_iter posi;
|
|
lsquic_packet_out_t *packet_out;
|
|
struct lsquic_stream streams[6];
|
|
struct stream_rec *srec;
|
|
|
|
memset(&enpub, 0, sizeof(enpub));
|
|
memset(&streams, 0, sizeof(streams));
|
|
lsquic_mm_init(&enpub.enp_mm);
|
|
packet_out = lsquic_mm_get_packet_out(&enpub.enp_mm, NULL, QUIC_MAX_PAYLOAD_SZ);
|
|
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[0], QUIC_FRAME_STREAM, 7, 1);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[1], QUIC_FRAME_STREAM, 8, 1);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[2], QUIC_FRAME_STREAM, 9, 1);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[1], QUIC_FRAME_RST_STREAM, 10, 0);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[3], QUIC_FRAME_STREAM, 11, 1);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[4], QUIC_FRAME_STREAM, 12, 1);
|
|
lsquic_packet_out_add_stream(packet_out, &enpub.enp_mm, &streams[5], QUIC_FRAME_STREAM, 13, 1);
|
|
|
|
srec = posi_first(&posi, packet_out);
|
|
assert(srec->sr_stream == &streams[0]);
|
|
assert(srec->sr_off == 7);
|
|
assert(srec->sr_frame_type == QUIC_FRAME_STREAM);
|
|
|
|
srec = posi_next(&posi);
|
|
assert(srec->sr_stream == &streams[1]);
|
|
assert(srec->sr_off == 8);
|
|
assert(srec->sr_frame_type == QUIC_FRAME_STREAM);
|
|
|
|
srec = posi_next(&posi);
|
|
assert(srec->sr_stream == &streams[2]);
|
|
assert(srec->sr_off == 9);
|
|
assert(srec->sr_frame_type == QUIC_FRAME_STREAM);
|
|
|
|
srec = posi_next(&posi);
|
|
assert(srec->sr_stream == &streams[1]);
|
|
assert(srec->sr_off == 10);
|
|
assert(srec->sr_frame_type == QUIC_FRAME_RST_STREAM);
|
|
|
|
srec = posi_next(&posi);
|
|
assert(srec->sr_stream == &streams[3]);
|
|
assert(srec->sr_off == 11);
|
|
assert(srec->sr_frame_type == QUIC_FRAME_STREAM);
|
|
|
|
srec = posi_next(&posi);
|
|
assert(srec->sr_stream == &streams[4]);
|
|
assert(srec->sr_off == 12);
|
|
assert(srec->sr_frame_type == QUIC_FRAME_STREAM);
|
|
|
|
srec = posi_next(&posi);
|
|
assert(srec->sr_stream == &streams[5]);
|
|
assert(srec->sr_off == 13);
|
|
assert(srec->sr_frame_type == QUIC_FRAME_STREAM);
|
|
|
|
assert((void *) 0 == posi_next(&posi));
|
|
|
|
lsquic_packet_out_destroy(packet_out, &enpub, NULL);
|
|
assert(!lsquic_malo_first(enpub.enp_mm.malo.stream_rec_arr));
|
|
|
|
lsquic_mm_cleanup(&enpub.enp_mm);
|
|
return 0;
|
|
}
|