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
8a59ce6d
Commit
8a59ce6d
authored
Sep 03, 2019
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Reconnect h1 backend if it lost connection before sending headers
parent
f2fde180
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+17
-2
No files found.
src/shrpx_http_downstream_connection.cc
View file @
8a59ce6d
...
@@ -158,6 +158,16 @@ void backend_retry(Downstream *downstream) {
...
@@ -158,6 +158,16 @@ void backend_retry(Downstream *downstream) {
}
}
}
// namespace
}
// namespace
namespace
{
void
retry_readcb
(
struct
ev_loop
*
loop
,
ev_io
*
w
,
int
revents
)
{
auto
conn
=
static_cast
<
Connection
*>
(
w
->
data
);
auto
dconn
=
static_cast
<
HttpDownstreamConnection
*>
(
conn
->
data
);
auto
downstream
=
dconn
->
get_downstream
();
retry_downstream_connection
(
downstream
,
502
);
}
}
// namespace
namespace
{
namespace
{
void
writecb
(
struct
ev_loop
*
loop
,
ev_io
*
w
,
int
revents
)
{
void
writecb
(
struct
ev_loop
*
loop
,
ev_io
*
w
,
int
revents
)
{
int
rv
;
int
rv
;
...
@@ -197,7 +207,7 @@ HttpDownstreamConnection::HttpDownstreamConnection(
...
@@ -197,7 +207,7 @@ HttpDownstreamConnection::HttpDownstreamConnection(
struct
ev_loop
*
loop
,
Worker
*
worker
)
struct
ev_loop
*
loop
,
Worker
*
worker
)
:
conn_
(
loop
,
-
1
,
nullptr
,
worker
->
get_mcpool
(),
:
conn_
(
loop
,
-
1
,
nullptr
,
worker
->
get_mcpool
(),
group
->
shared_addr
->
timeout
.
write
,
group
->
shared_addr
->
timeout
.
read
,
group
->
shared_addr
->
timeout
.
write
,
group
->
shared_addr
->
timeout
.
read
,
{},
{},
connectcb
,
readcb
,
connect_timeoutcb
,
this
,
{},
{},
connectcb
,
re
try_re
adcb
,
connect_timeoutcb
,
this
,
get_config
()
->
tls
.
dyn_rec
.
warmup_threshold
,
get_config
()
->
tls
.
dyn_rec
.
warmup_threshold
,
get_config
()
->
tls
.
dyn_rec
.
idle_timeout
,
Proto
::
HTTP1
),
get_config
()
->
tls
.
dyn_rec
.
idle_timeout
,
Proto
::
HTTP1
),
on_read_
(
&
HttpDownstreamConnection
::
noop
),
on_read_
(
&
HttpDownstreamConnection
::
noop
),
...
@@ -433,7 +443,10 @@ int HttpDownstreamConnection::initiate_connection() {
...
@@ -433,7 +443,10 @@ int HttpDownstreamConnection::initiate_connection() {
conn_
.
again_rt
(
group_
->
shared_addr
->
timeout
.
read
);
conn_
.
again_rt
(
group_
->
shared_addr
->
timeout
.
read
);
}
}
ev_set_cb
(
&
conn_
.
rev
,
readcb
);
// downstream host might close connection while waiting for
// request header fields. If it happens, establish new
// connection.
ev_set_cb
(
&
conn_
.
rev
,
retry_readcb
);
on_write_
=
&
HttpDownstreamConnection
::
write_first
;
on_write_
=
&
HttpDownstreamConnection
::
write_first
;
first_write_done_
=
false
;
first_write_done_
=
false
;
...
@@ -1166,6 +1179,8 @@ int HttpDownstreamConnection::write_first() {
...
@@ -1166,6 +1179,8 @@ int HttpDownstreamConnection::write_first() {
return
SHRPX_ERR_RETRY
;
return
SHRPX_ERR_RETRY
;
}
}
ev_set_cb
(
&
conn_
.
rev
,
readcb
);
if
(
conn_
.
tls
.
ssl
)
{
if
(
conn_
.
tls
.
ssl
)
{
on_write_
=
&
HttpDownstreamConnection
::
write_tls
;
on_write_
=
&
HttpDownstreamConnection
::
write_tls
;
}
else
{
}
else
{
...
...
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