Use the similar naming scheme for table size as 392256e542

This commit is contained in:
Tatsuhiro Tsujikawa 2016-09-11 22:25:01 +09:00
parent 392256e542
commit 743fc4a3c3
3 changed files with 34 additions and 32 deletions

View File

@ -4596,7 +4596,7 @@ typedef struct nghttp2_hd_deflater nghttp2_hd_deflater;
*
* Initializes |*deflater_ptr| for deflating name/values pairs.
*
* The |deflate_hd_table_bufsize_max| is the upper bound of header
* The |max_deflate_dynamic_table_size| is the upper bound of header
* table size the deflater will use.
*
* If this function fails, |*deflater_ptr| is left untouched.
@ -4607,8 +4607,9 @@ typedef struct nghttp2_hd_deflater nghttp2_hd_deflater;
* :enum:`NGHTTP2_ERR_NOMEM`
* Out of memory.
*/
NGHTTP2_EXTERN int nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr,
size_t deflate_hd_table_bufsize_max);
NGHTTP2_EXTERN int
nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr,
size_t max_deflate_dynamic_table_size);
/**
* @function
@ -4625,8 +4626,9 @@ NGHTTP2_EXTERN int nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr,
* The library code does not refer to |mem| pointer after this
* function returns, so the application can safely free it.
*/
NGHTTP2_EXTERN int nghttp2_hd_deflate_new2(nghttp2_hd_deflater **deflater_ptr,
size_t deflate_hd_table_bufsize_max,
NGHTTP2_EXTERN int
nghttp2_hd_deflate_new2(nghttp2_hd_deflater **deflater_ptr,
size_t max_deflate_dynamic_table_size,
nghttp2_mem *mem);
/**
@ -4640,18 +4642,18 @@ NGHTTP2_EXTERN void nghttp2_hd_deflate_del(nghttp2_hd_deflater *deflater);
* @function
*
* Changes header table size of the |deflater| to
* |settings_hd_table_bufsize_max| bytes. This may trigger eviction
* |settings_max_dynamic_table_size| bytes. This may trigger eviction
* in the dynamic table.
*
* The |settings_hd_table_bufsize_max| should be the value received in
* SETTINGS_HEADER_TABLE_SIZE.
* The |settings_max_dynamic_table_size| should be the value received
* in SETTINGS_HEADER_TABLE_SIZE.
*
* The deflater never uses more memory than
* ``deflate_hd_table_bufsize_max`` bytes specified in
* ``max_deflate_dynamic_table_size`` bytes specified in
* `nghttp2_hd_deflate_new()`. Therefore, if
* |settings_hd_table_bufsize_max| > ``deflate_hd_table_bufsize_max``,
* resulting maximum table size becomes
* ``deflate_hd_table_bufsize_max``.
* |settings_max_dynamic_table_size| >
* ``max_deflate_dynamic_table_size``, resulting maximum table size
* becomes ``max_deflate_dynamic_table_size``.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
@ -4661,7 +4663,7 @@ NGHTTP2_EXTERN void nghttp2_hd_deflate_del(nghttp2_hd_deflater *deflater);
*/
NGHTTP2_EXTERN int
nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater,
size_t settings_hd_table_bufsize_max);
size_t settings_max_dynamic_table_size);
/**
* @function
@ -4832,8 +4834,8 @@ NGHTTP2_EXTERN void nghttp2_hd_inflate_del(nghttp2_hd_inflater *inflater);
* Changes header table size in the |inflater|. This may trigger
* eviction in the dynamic table.
*
* The |settings_hd_table_bufsize_max| should be the value transmitted
* in SETTINGS_HEADER_TABLE_SIZE.
* The |settings_max_dynamic_table_size| should be the value
* transmitted in SETTINGS_HEADER_TABLE_SIZE.
*
* This function must not be called while header block is being
* inflated. In other words, this function must be called after
@ -4854,7 +4856,7 @@ NGHTTP2_EXTERN void nghttp2_hd_inflate_del(nghttp2_hd_inflater *inflater);
*/
NGHTTP2_EXTERN int
nghttp2_hd_inflate_change_table_size(nghttp2_hd_inflater *inflater,
size_t settings_hd_table_bufsize_max);
size_t settings_max_dynamic_table_size);
/**
* @enum

View File

@ -684,7 +684,7 @@ int nghttp2_hd_deflate_init(nghttp2_hd_deflater *deflater, nghttp2_mem *mem) {
}
int nghttp2_hd_deflate_init2(nghttp2_hd_deflater *deflater,
size_t deflate_hd_table_bufsize_max,
size_t max_deflate_dynamic_table_size,
nghttp2_mem *mem) {
int rv;
rv = hd_context_init(&deflater->ctx, mem);
@ -694,14 +694,14 @@ int nghttp2_hd_deflate_init2(nghttp2_hd_deflater *deflater,
hd_map_init(&deflater->map);
if (deflate_hd_table_bufsize_max < NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE) {
if (max_deflate_dynamic_table_size < NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE) {
deflater->notify_table_size_change = 1;
deflater->ctx.hd_table_bufsize_max = deflate_hd_table_bufsize_max;
deflater->ctx.hd_table_bufsize_max = max_deflate_dynamic_table_size;
} else {
deflater->notify_table_size_change = 0;
}
deflater->deflate_hd_table_bufsize_max = deflate_hd_table_bufsize_max;
deflater->deflate_hd_table_bufsize_max = max_deflate_dynamic_table_size;
deflater->min_hd_table_bufsize_max = UINT32_MAX;
return 0;
@ -1225,9 +1225,9 @@ static void hd_context_shrink_table_size(nghttp2_hd_context *context,
}
}
int nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater,
size_t settings_hd_table_bufsize_max) {
size_t next_bufsize = nghttp2_min(settings_hd_table_bufsize_max,
int nghttp2_hd_deflate_change_table_size(
nghttp2_hd_deflater *deflater, size_t settings_max_dynamic_table_size) {
size_t next_bufsize = nghttp2_min(settings_max_dynamic_table_size,
deflater->deflate_hd_table_bufsize_max);
deflater->ctx.hd_table_bufsize_max = next_bufsize;
@ -1241,8 +1241,8 @@ int nghttp2_hd_deflate_change_table_size(nghttp2_hd_deflater *deflater,
return 0;
}
int nghttp2_hd_inflate_change_table_size(nghttp2_hd_inflater *inflater,
size_t settings_hd_table_bufsize_max) {
int nghttp2_hd_inflate_change_table_size(
nghttp2_hd_inflater *inflater, size_t settings_max_dynamic_table_size) {
switch (inflater->state) {
case NGHTTP2_HD_STATE_EXPECT_TABLE_SIZE:
case NGHTTP2_HD_STATE_INFLATE_START:
@ -1258,16 +1258,16 @@ int nghttp2_hd_inflate_change_table_size(nghttp2_hd_inflater *inflater,
strictly smaller than the current negotiated maximum size,
encoder must send dynamic table size update. In other cases, we
cannot expect it to do so. */
if (inflater->ctx.hd_table_bufsize_max > settings_hd_table_bufsize_max) {
if (inflater->ctx.hd_table_bufsize_max > settings_max_dynamic_table_size) {
inflater->state = NGHTTP2_HD_STATE_EXPECT_TABLE_SIZE;
/* Remember minimum value, and validate that encoder sends the
value less than or equal to this. */
inflater->min_hd_table_bufsize_max = settings_hd_table_bufsize_max;
inflater->min_hd_table_bufsize_max = settings_max_dynamic_table_size;
}
inflater->settings_hd_table_bufsize_max = settings_hd_table_bufsize_max;
inflater->settings_hd_table_bufsize_max = settings_max_dynamic_table_size;
inflater->ctx.hd_table_bufsize_max = settings_hd_table_bufsize_max;
inflater->ctx.hd_table_bufsize_max = settings_max_dynamic_table_size;
hd_context_shrink_table_size(&inflater->ctx, NULL);
return 0;

View File

@ -288,7 +288,7 @@ int nghttp2_hd_deflate_init(nghttp2_hd_deflater *deflater, nghttp2_mem *mem);
/*
* Initializes |deflater| for deflating name/values pairs.
*
* The encoder only uses up to |deflate_hd_table_bufsize_max| bytes
* The encoder only uses up to |max_deflate_dynamic_table_size| bytes
* for header table even if the larger value is specified later in
* nghttp2_hd_change_table_size().
*
@ -299,7 +299,7 @@ int nghttp2_hd_deflate_init(nghttp2_hd_deflater *deflater, nghttp2_mem *mem);
* Out of memory.
*/
int nghttp2_hd_deflate_init2(nghttp2_hd_deflater *deflater,
size_t deflate_hd_table_bufsize_max,
size_t max_deflate_dynamic_table_size,
nghttp2_mem *mem);
/*