Embed nghttp2_ext_frame_payload into nghttp2_outbound_item
This commit is contained in:
parent
795ee8c20f
commit
31595c2416
|
@ -90,8 +90,6 @@ void nghttp2_outbound_item_free(nghttp2_outbound_item *item, nghttp2_mem *mem) {
|
||||||
assert(0);
|
assert(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
nghttp2_mem_free(mem, frame->ext.payload);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,6 +107,9 @@ typedef struct nghttp2_outbound_item nghttp2_outbound_item;
|
||||||
|
|
||||||
struct nghttp2_outbound_item {
|
struct nghttp2_outbound_item {
|
||||||
nghttp2_frame frame;
|
nghttp2_frame frame;
|
||||||
|
/* Storage for extension frame payload. frame->ext.payload points
|
||||||
|
to this structure to avoid frequent memory allocation. */
|
||||||
|
nghttp2_ext_frame_payload ext_frame_payload;
|
||||||
nghttp2_aux_data aux_data;
|
nghttp2_aux_data aux_data;
|
||||||
/* The priority used in priority comparion. Smaller is served
|
/* The priority used in priority comparion. Smaller is served
|
||||||
ealier. For PING, SETTINGS and non-DATA frames (excluding
|
ealier. For PING, SETTINGS and non-DATA frames (excluding
|
||||||
|
|
|
@ -470,11 +470,7 @@ int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags _U_,
|
||||||
|
|
||||||
item->aux_data.ext.builtin = 1;
|
item->aux_data.ext.builtin = 1;
|
||||||
|
|
||||||
altsvc = nghttp2_mem_malloc(mem, sizeof(nghttp2_ext_altsvc));
|
altsvc = &item->ext_frame_payload.altsvc;
|
||||||
if (altsvc == NULL) {
|
|
||||||
rv = NGHTTP2_ERR_NOMEM;
|
|
||||||
goto fail_altsvc_malloc;
|
|
||||||
}
|
|
||||||
|
|
||||||
frame = &item->frame;
|
frame = &item->frame;
|
||||||
frame->ext.payload = altsvc;
|
frame->ext.payload = altsvc;
|
||||||
|
@ -485,7 +481,6 @@ int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags _U_,
|
||||||
rv = nghttp2_session_add_item(session, item);
|
rv = nghttp2_session_add_item(session, item);
|
||||||
if (rv != 0) {
|
if (rv != 0) {
|
||||||
nghttp2_frame_altsvc_free(&frame->ext, mem);
|
nghttp2_frame_altsvc_free(&frame->ext, mem);
|
||||||
nghttp2_mem_free(mem, frame->ext.payload);
|
|
||||||
nghttp2_mem_free(mem, item);
|
nghttp2_mem_free(mem, item);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
@ -493,8 +488,6 @@ int nghttp2_submit_altsvc(nghttp2_session *session, uint8_t flags _U_,
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail_altsvc_malloc:
|
|
||||||
free(item);
|
|
||||||
fail_item_malloc:
|
fail_item_malloc:
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue