songgaoye commented on code in PR #3606:
URL: https://github.com/apache/brpc/pull/3606#discussion_r4272201133
##########
src/brpc/http_header.cpp:
##########
@@ -136,22 +139,34 @@ std::string& HttpHeader::GetOrAddHeader(const
std::string& key) {
std::string* val = _headers.seek(key);
if (nullptr == val) {
+ const size_t old_bucket_count = _headers.bucket_count();
val = _headers.insert({ key, "" });
if (is_set_cookie) {
_first_set_cookie = val;
}
+ if (_headers.bucket_count() != old_bucket_count) {
+ RefreshFirstSetCookie();
+ }
Review Comment:
the duplicated three-line rehash check keeps each mutation
path explicit
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]