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
1320d7ef
Commit
1320d7ef
authored
3 years ago
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Do not accept new connection during graceful shutdown period
parent
7cdc6cfa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
2 deletions
+36
-2
src/shrpx_http3_upstream.cc
src/shrpx_http3_upstream.cc
+18
-2
src/shrpx_http3_upstream.h
src/shrpx_http3_upstream.h
+1
-0
src/shrpx_quic_connection_handler.cc
src/shrpx_quic_connection_handler.cc
+17
-0
No files found.
src/shrpx_http3_upstream.cc
View file @
1320d7ef
...
...
@@ -124,7 +124,8 @@ Http3Upstream::Http3Upstream(ClientHandler *handler)
httpconn_
{
nullptr
},
downstream_queue_
{
downstream_queue_size
(
handler
->
get_worker
()),
!
get_config
()
->
http2_proxy
},
idle_close_
{
false
}
{
idle_close_
{
false
},
retry_close_
{
false
}
{
ev_timer_init
(
&
timer_
,
timeoutcb
,
0.
,
0.
);
timer_
.
data
=
this
;
...
...
@@ -1338,7 +1339,7 @@ void Http3Upstream::on_handler_delete() {
quic_conn_handler
->
remove_connection_id
(
&
cid
);
}
if
(
idle_close_
)
{
if
(
idle_close_
||
retry_close_
)
{
return
;
}
...
...
@@ -1624,6 +1625,21 @@ int Http3Upstream::on_read(const UpstreamAddr *faddr,
return
-
1
;
}
if
(
worker
->
get_graceful_shutdown
())
{
ngtcp2_cid
ini_dcid
,
ini_scid
;
ngtcp2_cid_init
(
&
ini_dcid
,
dcid
,
dcidlen
);
ngtcp2_cid_init
(
&
ini_scid
,
scid
,
scidlen
);
quic_conn_handler
->
send_connection_close
(
faddr
,
version
,
&
ini_dcid
,
&
ini_scid
,
remote_addr
,
local_addr
,
NGTCP2_CONNECTION_REFUSED
);
return
-
1
;
}
retry_close_
=
true
;
quic_conn_handler
->
send_retry
(
handler_
->
get_upstream_addr
(),
version
,
dcid
,
dcidlen
,
scid
,
scidlen
,
remote_addr
,
local_addr
);
...
...
This diff is collapsed.
Click to expand it.
src/shrpx_http3_upstream.h
View file @
1320d7ef
...
...
@@ -166,6 +166,7 @@ private:
nghttp3_conn
*
httpconn_
;
DownstreamQueue
downstream_queue_
;
bool
idle_close_
;
bool
retry_close_
;
std
::
vector
<
uint8_t
>
conn_close_
;
};
...
...
This diff is collapsed.
Click to expand it.
src/shrpx_quic_connection_handler.cc
View file @
1320d7ef
...
...
@@ -180,6 +180,12 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr,
return
0
;
}
if
(
worker_
->
get_graceful_shutdown
())
{
send_connection_close
(
faddr
,
version
,
&
hd
.
dcid
,
&
hd
.
scid
,
remote_addr
,
local_addr
,
NGTCP2_CONNECTION_REFUSED
);
return
0
;
}
if
(
hd
.
token
.
len
==
0
)
{
if
(
quicconf
.
upstream
.
require_token
)
{
send_retry
(
faddr
,
version
,
dcid
,
dcidlen
,
scid
,
scidlen
,
remote_addr
,
...
...
@@ -262,6 +268,12 @@ int QUICConnectionHandler::handle_packet(const UpstreamAddr *faddr,
break
;
}
case
NGTCP2_ERR_RETRY
:
if
(
worker_
->
get_graceful_shutdown
())
{
send_connection_close
(
faddr
,
version
,
&
hd
.
dcid
,
&
hd
.
scid
,
remote_addr
,
local_addr
,
NGTCP2_CONNECTION_REFUSED
);
return
0
;
}
send_retry
(
faddr
,
version
,
dcid
,
dcidlen
,
scid
,
scidlen
,
remote_addr
,
local_addr
);
return
0
;
...
...
@@ -456,6 +468,11 @@ int QUICConnectionHandler::send_retry(
auto
d
=
static_cast
<
ev_tstamp
>
(
NGTCP2_DEFAULT_INITIAL_RTT
*
3
)
/
NGTCP2_SECONDS
;
if
(
LOG_ENABLED
(
INFO
))
{
LOG
(
INFO
)
<<
"Enter close-wait period "
<<
d
<<
"s with "
<<
buf
.
size
()
<<
" bytes sentinel packet"
;
}
auto
cw
=
std
::
make_unique
<
CloseWait
>
(
worker_
,
std
::
vector
<
ngtcp2_cid
>
{
idcid
},
std
::
move
(
buf
),
d
);
...
...
This diff is collapsed.
Click to expand it.
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