Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
b5900a38
Commit
b5900a38
authored
Sep 30, 2018
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only remove from _header_index when value is non-empty
parent
6b83a5d8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
hpack.cpp
src/brpc/details/hpack.cpp
+13
-13
No files found.
src/brpc/details/hpack.cpp
View file @
b5900a38
...
...
@@ -108,9 +108,7 @@ public:
return
_start_index
+
(
_add_times
-
*
v
)
-
1
;
}
bool
empty
()
const
{
return
(
size
()
==
0
);
}
size_t
size
()
const
{
return
_size
;
}
size_t
max_size
()
const
{
return
_max_size
;
}
bool
empty
()
const
{
return
_size
==
0
;
}
int
start_index
()
const
{
return
_start_index
;
}
int
end_index
()
const
{
return
start_index
()
+
_header_queue
.
size
();
}
...
...
@@ -123,7 +121,7 @@ public:
DCHECK
(
!
empty
());
const
Header
*
h
=
_header_queue
.
top
();
const
size_t
entry_size
=
HeaderSize
(
*
h
);
DCHECK_LE
(
entry_size
,
size
()
);
DCHECK_LE
(
entry_size
,
_size
);
const
uint64_t
id
=
_add_times
-
_header_queue
.
size
();
if
(
_need_indexes
)
{
RemoveHeaderFromIndexes
(
*
h
,
id
);
...
...
@@ -133,12 +131,14 @@ public:
}
void
RemoveHeaderFromIndexes
(
const
Header
&
h
,
uint64_t
expected_id
)
{
const
uint64_t
*
v
=
_header_index
.
seek
(
h
);
DCHECK
(
v
);
if
(
*
v
==
expected_id
)
{
_header_index
.
erase
(
h
);
if
(
!
h
.
value
.
empty
())
{
const
uint64_t
*
v
=
_header_index
.
seek
(
h
);
DCHECK
(
v
);
if
(
*
v
==
expected_id
)
{
_header_index
.
erase
(
h
);
}
}
v
=
_name_index
.
seek
(
h
.
name
);
const
uint64_t
*
v
=
_name_index
.
seek
(
h
.
name
);
DCHECK
(
v
);
if
(
*
v
==
expected_id
)
{
_name_index
.
erase
(
h
.
name
);
...
...
@@ -153,7 +153,7 @@ public:
PopHeader
();
}
if
(
entry_size
>
max_size
()
)
{
if
(
entry_size
>
_max_size
)
{
// https://tools.ietf.org/html/rfc7541#section-4.1
// If this header is larger than the max size, clear the table only.
DCHECK
(
empty
());
...
...
@@ -175,8 +175,8 @@ public:
}
void
ResetMaxSize
(
size_t
new_max_size
)
{
LOG
(
INFO
)
<<
this
<<
".size="
<<
size
()
<<
" new_max_size="
<<
new_max_size
<<
" max_size="
<<
max_size
()
;
LOG
(
INFO
)
<<
this
<<
".size="
<<
_size
<<
" new_max_size="
<<
new_max_size
<<
" max_size="
<<
_max_size
;
if
(
new_max_size
>
_max_size
)
{
//LOG(ERROR) << "Invalid new_max_size=" << new_max_size;
//return -1;
...
...
@@ -185,7 +185,7 @@ public:
}
if
(
new_max_size
<
_max_size
)
{
_max_size
=
new_max_size
;
while
(
size
()
>
max_size
()
)
{
while
(
_size
>
_max_size
)
{
PopHeader
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment