picoquic/frames.c
uint8_t * picoquic_format_stream_reset_frame(picoquic_cnx_t* cnx, picoquic_stream_head_t* stream,
    uint8_t* bytes, uint8_t * bytes_max, int * more_data, int * is_pure_ack)
{
    uint8_t* bytes0 = bytes;

    if (stream->reset_requested && !stream->reset_sent) {
        if ((bytes = picoquic_frames_uint8_encode(bytes, bytes_max, picoquic_frame_type_reset_stream)) != NULL &&
            (bytes = picoquic_frames_varint_encode(bytes, bytes_max, stream->stream_id)) != NULL &&
            (bytes = picoquic_frames_varint_encode(bytes, bytes_max, stream->local_error)) != NULL &&
            (bytes = picoquic_frames_varint_encode(bytes, bytes_max, stream->sent_offset)) != NULL)
        {
            *is_pure_ack = 0;
            stream->reset_sent = 1;
            stream->fin_sent = 1;

            picoquic_update_max_stream_ID_local(cnx, stream);

            /* Free the queued data */
            while (stream->send_queue != NULL) {
                picoquic_stream_data_node_t* next = stream->send_queue->next_stream_data;
                if (stream->send_queue->bytes != NULL) {
                    free(stream->send_queue->bytes);
                }
                free(stream->send_queue);
                stream->send_queue = next;
            }
            (void)picoquic_delete_stream_if_closed(cnx, stream);
        }
        else {
            *more_data = 1;
            bytes = bytes0;
        }
    }

    return bytes;
}
/*
 * RST_STREAM Frame
 *
 * An endpoint may use a RST_STREAM frame (type=0x01) to abruptly terminate a stream.
 */
RST_STREAM Frame
An endpoint may use a RST_STREAM frame (type=0x01) to abruptly terminate a stream.
RST_STREAM Frame An endpoint may use a RST_STREAM frame ( type = 0x01 ) to abruptly terminate a stream .
uint8_t * picoquic_format_stream_reset_frame(picoquic_cnx_t* cnx, picoquic_stream_head_t* stream,
    uint8_t* bytes, uint8_t * bytes_max, int * more_data, int * is_pure_ack)
{
    uint8_t* bytes0 = bytes;
    if (stream->reset_requested && !stream->reset_sent) {
        if ((bytes = picoquic_frames_uint8_encode(bytes, bytes_max, picoquic_frame_type_reset_stream)) != NULL &&
            (bytes = picoquic_frames_varint_encode(bytes, bytes_max, stream->stream_id)) != NULL &&
            (bytes = picoquic_frames_varint_encode(bytes, bytes_max, stream->local_error)) != NULL &&
            (bytes = picoquic_frames_varint_encode(bytes, bytes_max, stream->sent_offset)) != NULL)
        {
            *is_pure_ack = 0;
            stream->reset_sent = 1;
            stream->fin_sent = 1;
            picoquic_update_max_stream_ID_local(cnx, stream);
            while (stream->send_queue != NULL) {
                picoquic_stream_data_node_t* next = stream->send_queue->next_stream_data;
                if (stream->send_queue->bytes != NULL) {
                    free(stream->send_queue->bytes);
                }
                free(stream->send_queue);
                stream->send_queue = next;
            }
            (void)picoquic_delete_stream_if_closed(cnx, stream);
        }
        else {
            *more_data = 1;
            bytes = bytes0;
        }
    }
    return bytes;
}
uint8_t * picoquic_format_stream_reset_frame ( picoquic_cnx_t * cnx , picoquic_stream_head_t * stream , uint8_t * bytes , uint8_t * bytes_max , int * more_data , int * is_pure_ack ) { uint8_t * bytes0 = bytes ; if ( stream -> reset_requested && ! stream -> reset_sent ) { if ( ( bytes = picoquic_frames_uint8_encode ( bytes , bytes_max , picoquic_frame_type_reset_stream ) ) != NULL && ( bytes = picoquic_frames_varint_encode ( bytes , bytes_max , stream -> stream_id ) ) != NULL && ( bytes = picoquic_frames_varint_encode ( bytes , bytes_max , stream -> local_error ) ) != NULL && ( bytes = picoquic_frames_varint_encode ( bytes , bytes_max , stream -> sent_offset ) ) != NULL ) { * is_pure_ack = 0 ; stream -> reset_sent = 1 ; stream -> fin_sent = 1 ; picoquic_update_max_stream_ID_local ( cnx , stream ) ; while ( stream -> send_queue != NULL ) { picoquic_stream_data_node_t * next = stream -> send_queue -> next_stream_data ; if ( stream -> send_queue -> bytes != NULL ) { free ( stream -> send_queue -> bytes ) ; } free ( stream -> send_queue ) ; stream -> send_queue = next ; } ( void ) picoquic_delete_stream_if_closed ( cnx , stream ) ; } else { * more_data = 1 ; bytes = bytes0 ; } } return bytes ; }
RST_STREAM Frame
 An endpoint may use a RST_STREAM frame (type=0x01) to abruptly terminate a stream.
RST_STREAM Frame An endpoint may use a RST_STREAM frame ( type = 0x01 ) to abruptly terminate a stream .
/* Free the queued data */