view src/event/quic/ngx_event_quic_migration.c @ 8746:0c628de2e2b7 quic

QUIC: separate function for connection ids initialization. The function correctly cleans up resources in case of failure to create initial server id: it removes previously created udp node for odcid from listening rbtree.
author Vladimir Homutov <vl@nginx.com>
date Fri, 09 Apr 2021 11:33:10 +0300
parents 76f476ce4d31
children c8bda5e1e662
line wrap: on
line source


/*
 * Copyright (C) Nginx, Inc.
 */


#include <ngx_config.h>
#include <ngx_core.h>
#include <ngx_event.h>
#include <ngx_event_quic_transport.h>
#include <ngx_event_quic_connection.h>
#include <ngx_event_quic_migration.h>


ngx_int_t
ngx_quic_handle_path_challenge_frame(ngx_connection_t *c,
    ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f)
{
    ngx_quic_frame_t       *frame;
    ngx_quic_connection_t  *qc;

    qc = ngx_quic_get_connection(c);

    frame = ngx_quic_alloc_frame(c);
    if (frame == NULL) {
        return NGX_ERROR;
    }

    frame->level = pkt->level;
    frame->type = NGX_QUIC_FT_PATH_RESPONSE;
    frame->u.path_response = *f;

    ngx_quic_queue_frame(qc, frame);

    return NGX_OK;
}


ngx_int_t
ngx_quic_handle_path_response_frame(ngx_connection_t *c,
    ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f)
{
    /* TODO */
    return NGX_OK;
}