Remove flags parameter from nghttp2_pack_extension_callback

It has no usecase at the moment.  It is most likely that applications
know the flags when it submitted extension frame, no need to modify it
later.  Possibly feature bloat.
This commit is contained in:
Tatsuhiro Tsujikawa 2015-11-17 21:29:21 +09:00
parent eb4e402aae
commit 83cc2511e3
3 changed files with 7 additions and 14 deletions

View File

@ -1747,11 +1747,9 @@ typedef int (*nghttp2_unpack_extension_callback)(nghttp2_session *session,
* extension payload in its wire format. The frame header will be
* packed by library. Application must pack payload only.
* frame->ext.payload is the object passed to
* `nghttp2_submit_extension()` as payload parameter. The |*flags| is
* initialized to the flags parameter passed in
* `nghttp2_submit_extension()`. Application can modify flags value
* if it wants. Application must pack extension payload to the |buf|
* of its capacity |len| bytes.
* `nghttp2_submit_extension()` as payload parameter. Application
* must pack extension payload to the |buf| of its capacity |len|
* bytes.
*
* The implementation of this function returns the number of bytes
* written into |buf| when it succeeds.
@ -1770,8 +1768,7 @@ typedef int (*nghttp2_unpack_extension_callback)(nghttp2_session *session,
* :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`.
*/
typedef ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session,
uint8_t *flags, uint8_t *buf,
size_t len,
uint8_t *buf, size_t len,
const nghttp2_frame *frame,
void *user_data);

View File

@ -1738,19 +1738,17 @@ static size_t session_estimate_headers_payload(nghttp2_session *session,
static int session_pack_extension(nghttp2_session *session, nghttp2_bufs *bufs,
nghttp2_frame *frame) {
ssize_t rv;
uint8_t flags;
nghttp2_buf *buf;
size_t buflen;
size_t framelen;
assert(session->callbacks.pack_extension_callback);
flags = frame->hd.flags;
buf = &bufs->head->buf;
buflen = nghttp2_min(nghttp2_buf_avail(buf), NGHTTP2_MAX_PAYLOADLEN);
rv = session->callbacks.pack_extension_callback(
session, &flags, buf->last, buflen, frame, session->user_data);
rv = session->callbacks.pack_extension_callback(session, buf->last, buflen,
frame, session->user_data);
if (rv == NGHTTP2_ERR_CANCEL) {
return (int)rv;
}
@ -1761,7 +1759,6 @@ static int session_pack_extension(nghttp2_session *session, nghttp2_bufs *bufs,
framelen = (size_t)rv;
frame->hd.flags = flags;
frame->hd.length = framelen;
assert(buf->pos == buf->last);

View File

@ -435,8 +435,7 @@ static int on_stream_close_callback(nghttp2_session *session _U_,
}
static ssize_t pack_extension_callback(nghttp2_session *session _U_,
uint8_t *flags _U_, uint8_t *buf,
size_t len _U_,
uint8_t *buf, size_t len _U_,
const nghttp2_frame *frame,
void *user_data _U_) {
nghttp2_buf *p = frame->ext.payload;