Mercurial > hg > nginx-quic
comparison src/event/ngx_event_quic.c @ 8197:405b6e8eb523 quic
QUIC: renamed field and function related to client ids.
Particularly, c->curr_seqnum is renamed to c->client_seqnum and
ngx_quic_alloc_connection_id() is renamed to ngx_quic_alloc_client_id().
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Mon, 09 Nov 2020 18:58:29 +0000 |
parents | e0947c952d43 |
children | 45db1b5c1706 |
comparison
equal
deleted
inserted
replaced
8196:e0947c952d43 | 8197:405b6e8eb523 |
---|---|
123 | 123 |
124 ngx_queue_t client_ids; | 124 ngx_queue_t client_ids; |
125 ngx_queue_t free_client_ids; | 125 ngx_queue_t free_client_ids; |
126 ngx_uint_t nclient_ids; | 126 ngx_uint_t nclient_ids; |
127 uint64_t max_retired_seqnum; | 127 uint64_t max_retired_seqnum; |
128 uint64_t curr_seqnum; | 128 uint64_t client_seqnum; |
129 | 129 |
130 ngx_uint_t client_tp_done; | 130 ngx_uint_t client_tp_done; |
131 ngx_quic_tp_t tp; | 131 ngx_quic_tp_t tp; |
132 ngx_quic_tp_t ctp; | 132 ngx_quic_tp_t ctp; |
133 | 133 |
302 ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f); | 302 ngx_quic_header_t *pkt, ngx_quic_path_challenge_frame_t *f); |
303 static ngx_int_t ngx_quic_handle_new_connection_id_frame(ngx_connection_t *c, | 303 static ngx_int_t ngx_quic_handle_new_connection_id_frame(ngx_connection_t *c, |
304 ngx_quic_header_t *pkt, ngx_quic_new_conn_id_frame_t *f); | 304 ngx_quic_header_t *pkt, ngx_quic_new_conn_id_frame_t *f); |
305 static ngx_int_t ngx_quic_retire_connection_id(ngx_connection_t *c, | 305 static ngx_int_t ngx_quic_retire_connection_id(ngx_connection_t *c, |
306 enum ssl_encryption_level_t level, uint64_t seqnum); | 306 enum ssl_encryption_level_t level, uint64_t seqnum); |
307 static ngx_quic_client_id_t *ngx_quic_alloc_connection_id(ngx_connection_t *c, | 307 static ngx_quic_client_id_t *ngx_quic_alloc_client_id(ngx_connection_t *c, |
308 ngx_quic_connection_t *qc); | 308 ngx_quic_connection_t *qc); |
309 | 309 |
310 static void ngx_quic_queue_frame(ngx_quic_connection_t *qc, | 310 static void ngx_quic_queue_frame(ngx_quic_connection_t *qc, |
311 ngx_quic_frame_t *frame); | 311 ngx_quic_frame_t *frame); |
312 | 312 |
1040 if (qc->scid.data == NULL) { | 1040 if (qc->scid.data == NULL) { |
1041 return NULL; | 1041 return NULL; |
1042 } | 1042 } |
1043 ngx_memcpy(qc->scid.data, pkt->scid.data, qc->scid.len); | 1043 ngx_memcpy(qc->scid.data, pkt->scid.data, qc->scid.len); |
1044 | 1044 |
1045 cid = ngx_quic_alloc_connection_id(c, qc); | 1045 cid = ngx_quic_alloc_client_id(c, qc); |
1046 if (cid == NULL) { | 1046 if (cid == NULL) { |
1047 return NULL; | 1047 return NULL; |
1048 } | 1048 } |
1049 | 1049 |
1050 cid->seqnum = 0; | 1050 cid->seqnum = 0; |
1051 cid->len = pkt->scid.len; | 1051 cid->len = pkt->scid.len; |
1052 ngx_memcpy(cid->id, pkt->scid.data, pkt->scid.len); | 1052 ngx_memcpy(cid->id, pkt->scid.data, pkt->scid.len); |
1053 | 1053 |
1054 ngx_queue_insert_tail(&qc->client_ids, &cid->queue); | 1054 ngx_queue_insert_tail(&qc->client_ids, &cid->queue); |
1055 qc->nclient_ids++; | 1055 qc->nclient_ids++; |
1056 qc->curr_seqnum = 0; | 1056 qc->client_seqnum = 0; |
1057 | 1057 |
1058 return qc; | 1058 return qc; |
1059 } | 1059 } |
1060 | 1060 |
1061 | 1061 |
4163 return NGX_ERROR; | 4163 return NGX_ERROR; |
4164 } | 4164 } |
4165 | 4165 |
4166 } else { | 4166 } else { |
4167 | 4167 |
4168 cid = ngx_quic_alloc_connection_id(c, qc); | 4168 cid = ngx_quic_alloc_client_id(c, qc); |
4169 if (cid == NULL) { | 4169 if (cid == NULL) { |
4170 return NGX_ERROR; | 4170 return NGX_ERROR; |
4171 } | 4171 } |
4172 | 4172 |
4173 cid->seqnum = f->seqnum; | 4173 cid->seqnum = f->seqnum; |
4178 | 4178 |
4179 ngx_queue_insert_tail(&qc->client_ids, &cid->queue); | 4179 ngx_queue_insert_tail(&qc->client_ids, &cid->queue); |
4180 qc->nclient_ids++; | 4180 qc->nclient_ids++; |
4181 | 4181 |
4182 /* always use latest available connection id */ | 4182 /* always use latest available connection id */ |
4183 if (f->seqnum > qc->curr_seqnum) { | 4183 if (f->seqnum > qc->client_seqnum) { |
4184 qc->scid.len = cid->len; | 4184 qc->scid.len = cid->len; |
4185 qc->scid.data = cid->id; | 4185 qc->scid.data = cid->id; |
4186 qc->curr_seqnum = f->seqnum; | 4186 qc->client_seqnum = f->seqnum; |
4187 } | 4187 } |
4188 } | 4188 } |
4189 | 4189 |
4190 retire: | 4190 retire: |
4191 | 4191 |
4264 return NGX_OK; | 4264 return NGX_OK; |
4265 } | 4265 } |
4266 | 4266 |
4267 | 4267 |
4268 static ngx_quic_client_id_t * | 4268 static ngx_quic_client_id_t * |
4269 ngx_quic_alloc_connection_id(ngx_connection_t *c, ngx_quic_connection_t *qc) | 4269 ngx_quic_alloc_client_id(ngx_connection_t *c, ngx_quic_connection_t *qc) |
4270 { | 4270 { |
4271 ngx_queue_t *q; | 4271 ngx_queue_t *q; |
4272 ngx_quic_client_id_t *cid; | 4272 ngx_quic_client_id_t *cid; |
4273 | 4273 |
4274 if (!ngx_queue_empty(&qc->free_client_ids)) { | 4274 if (!ngx_queue_empty(&qc->free_client_ids)) { |