Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
cb7269f3
Commit
cb7269f3
authored
Jun 04, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Close and disallow h1 backend connection on backend replacement
parent
0ca7c4cb
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
8 deletions
+25
-8
src/shrpx_downstream_connection_pool.cc
src/shrpx_downstream_connection_pool.cc
+5
-1
src/shrpx_downstream_connection_pool.h
src/shrpx_downstream_connection_pool.h
+1
-0
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+7
-1
src/shrpx_http_downstream_connection.h
src/shrpx_http_downstream_connection.h
+1
-1
src/shrpx_worker.cc
src/shrpx_worker.cc
+7
-5
src/shrpx_worker.h
src/shrpx_worker.h
+4
-0
No files found.
src/shrpx_downstream_connection_pool.cc
View file @
cb7269f3
...
...
@@ -29,10 +29,14 @@ namespace shrpx {
DownstreamConnectionPool
::
DownstreamConnectionPool
()
{}
DownstreamConnectionPool
::~
DownstreamConnectionPool
()
{
DownstreamConnectionPool
::~
DownstreamConnectionPool
()
{
remove_all
();
}
void
DownstreamConnectionPool
::
remove_all
()
{
for
(
auto
dconn
:
pool_
)
{
delete
dconn
;
}
pool_
.
clear
();
}
void
DownstreamConnectionPool
::
add_downstream_connection
(
...
...
src/shrpx_downstream_connection_pool.h
View file @
cb7269f3
...
...
@@ -42,6 +42,7 @@ public:
void
add_downstream_connection
(
std
::
unique_ptr
<
DownstreamConnection
>
dconn
);
std
::
unique_ptr
<
DownstreamConnection
>
pop_downstream_connection
();
void
remove_downstream_connection
(
DownstreamConnection
*
dconn
);
void
remove_all
();
private:
std
::
set
<
DownstreamConnection
*>
pool_
;
...
...
src/shrpx_http_downstream_connection.cc
View file @
cb7269f3
...
...
@@ -166,7 +166,11 @@ HttpDownstreamConnection::HttpDownstreamConnection(
ioctrl_
(
&
conn_
.
rlimit
),
response_htp_
{
0
}
{}
HttpDownstreamConnection
::~
HttpDownstreamConnection
()
{}
HttpDownstreamConnection
::~
HttpDownstreamConnection
()
{
if
(
LOG_ENABLED
(
INFO
))
{
DCLOG
(
INFO
,
this
)
<<
"Deleted"
;
}
}
int
HttpDownstreamConnection
::
attach_downstream
(
Downstream
*
downstream
)
{
if
(
LOG_ENABLED
(
INFO
))
{
...
...
@@ -1173,4 +1177,6 @@ HttpDownstreamConnection::get_downstream_addr_group() const {
DownstreamAddr
*
HttpDownstreamConnection
::
get_addr
()
const
{
return
addr_
;
}
bool
HttpDownstreamConnection
::
poolable
()
const
{
return
!
group_
->
retired
;
}
}
// namespace shrpx
src/shrpx_http_downstream_connection.h
View file @
cb7269f3
...
...
@@ -61,7 +61,7 @@ public:
virtual
void
on_upstream_change
(
Upstream
*
upstream
);
virtual
bool
poolable
()
const
{
return
true
;
}
virtual
bool
poolable
()
const
;
virtual
DownstreamAddrGroup
*
get_downstream_addr_group
()
const
;
...
...
src/shrpx_worker.cc
View file @
cb7269f3
...
...
@@ -141,6 +141,11 @@ Worker::Worker(struct ev_loop *loop, SSL_CTX *sv_ssl_ctx, SSL_CTX *cl_ssl_ctx,
void
Worker
::
replace_downstream_config
(
std
::
shared_ptr
<
DownstreamConfig
>
downstreamconf
)
{
for
(
auto
&
g
:
downstream_addr_groups_
)
{
g
->
retired
=
true
;
g
->
shared_addr
->
dconn_pool
.
remove_all
();
}
downstreamconf_
=
downstreamconf
;
downstream_addr_groups_
=
std
::
vector
<
std
::
shared_ptr
<
DownstreamAddrGroup
>>
(
...
...
@@ -153,14 +158,11 @@ void Worker::replace_downstream_config(
dst
=
std
::
make_shared
<
DownstreamAddrGroup
>
();
dst
->
pattern
=
src
.
pattern
;
// TODO for some reason, clang-3.6 which comes with Ubuntu 15.10
// does not value initialize with std::make_shared.
auto
shared_addr
=
std
::
make_shared
<
SharedDownstreamAddr
>
();
// TODO for some reason, clang-3.6 which comes with Ubuntu 15.10
// does not value initialize SharedDownstreamAddr above.
shared_addr
->
next
=
0
;
shared_addr
->
addrs
.
resize
(
src
.
addrs
.
size
());
shared_addr
->
http1_pri
=
{};
shared_addr
->
http2_pri
=
{};
size_t
num_http1
=
0
;
size_t
num_http2
=
0
;
...
...
src/shrpx_worker.h
View file @
cb7269f3
...
...
@@ -144,6 +144,10 @@ struct SharedDownstreamAddr {
struct
DownstreamAddrGroup
{
ImmutableString
pattern
;
std
::
shared_ptr
<
SharedDownstreamAddr
>
shared_addr
;
// true if this group is no longer used for new request. If this is
// true, the connection made using one of address in shared_addr
// must not be pooled.
bool
retired
;
};
struct
WorkerStat
{
...
...
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