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
ef3fa23b
Commit
ef3fa23b
authored
Jun 04, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Send GOAWAY for retired h2 backend connection
parent
cb7269f3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
src/shrpx_http2_session.cc
src/shrpx_http2_session.cc
+27
-0
src/shrpx_http2_session.h
src/shrpx_http2_session.h
+6
-0
No files found.
src/shrpx_http2_session.cc
View file @
ef3fa23b
...
...
@@ -171,6 +171,13 @@ void initiate_connection_cb(struct ev_loop *loop, ev_timer *w, int revents) {
}
}
// namespace
namespace
{
void
prepare_cb
(
struct
ev_loop
*
loop
,
ev_prepare
*
w
,
int
revents
)
{
auto
http2session
=
static_cast
<
Http2Session
*>
(
w
->
data
);
http2session
->
check_retire
();
}
}
// namespace
Http2Session
::
Http2Session
(
struct
ev_loop
*
loop
,
SSL_CTX
*
ssl_ctx
,
Worker
*
worker
,
const
std
::
shared_ptr
<
DownstreamAddrGroup
>
&
group
,
...
...
@@ -211,6 +218,10 @@ Http2Session::Http2Session(struct ev_loop *loop, SSL_CTX *ssl_ctx,
ev_timer_init
(
&
initiate_connection_timer_
,
initiate_connection_cb
,
0.
,
0.
);
initiate_connection_timer_
.
data
=
this
;
ev_prepare_init
(
&
prep_
,
prepare_cb
);
prep_
.
data
=
this
;
ev_prepare_start
(
loop
,
&
prep_
);
}
Http2Session
::~
Http2Session
()
{
...
...
@@ -230,6 +241,8 @@ int Http2Session::disconnect(bool hard) {
conn_
.
rlimit
.
stopw
();
conn_
.
wlimit
.
stopw
();
ev_prepare_stop
(
conn_
.
loop
,
&
prep_
);
ev_timer_stop
(
conn_
.
loop
,
&
initiate_connection_timer_
);
ev_timer_stop
(
conn_
.
loop
,
&
settings_timer_
);
ev_timer_stop
(
conn_
.
loop
,
&
connchk_timer_
);
...
...
@@ -2195,4 +2208,18 @@ void Http2Session::on_timeout() {
}
}
void
Http2Session
::
check_retire
()
{
if
(
!
group_
->
retired
)
{
return
;
}
ev_prepare_stop
(
conn_
.
loop
,
&
prep_
);
auto
last_stream_id
=
nghttp2_session_get_last_proc_stream_id
(
session_
);
nghttp2_submit_goaway
(
session_
,
NGHTTP2_FLAG_NONE
,
last_stream_id
,
NGHTTP2_NO_ERROR
,
nullptr
,
0
);
signal_write
();
}
}
// namespace shrpx
src/shrpx_http2_session.h
View file @
ef3fa23b
...
...
@@ -200,6 +200,11 @@ public:
void
on_timeout
();
// This is called periodically using ev_prepare watcher, and if
// group_ is retired (backend has been replaced), send GOAWAY to
// shutdown the connection.
void
check_retire
();
enum
{
// Disconnected
DISCONNECTED
,
...
...
@@ -241,6 +246,7 @@ private:
ev_timer
connchk_timer_
;
// timer to initiate connection. usually, this fires immediately.
ev_timer
initiate_connection_timer_
;
ev_prepare
prep_
;
DList
<
Http2DownstreamConnection
>
dconns_
;
DList
<
StreamData
>
streams_
;
std
::
function
<
int
(
Http2Session
&
)
>
read_
,
write_
;
...
...
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