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
556811ec
Commit
556811ec
authored
Dec 15, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Don't connect backend if connection is not establish up front
parent
403ece66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
9 deletions
+19
-9
src/shrpx_http2_session.cc
src/shrpx_http2_session.cc
+16
-8
src/shrpx_http2_session.h
src/shrpx_http2_session.h
+3
-1
No files found.
src/shrpx_http2_session.cc
View file @
556811ec
...
@@ -60,7 +60,7 @@ Http2Session::Http2Session(event_base *evbase, SSL_CTX *ssl_ctx)
...
@@ -60,7 +60,7 @@ Http2Session::Http2Session(event_base *evbase, SSL_CTX *ssl_ctx)
Http2Session
::~
Http2Session
()
{
disconnect
();
}
Http2Session
::~
Http2Session
()
{
disconnect
();
}
int
Http2Session
::
disconnect
()
{
int
Http2Session
::
disconnect
(
bool
hard
)
{
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
SSLOG
(
INFO
,
this
)
<<
"Disconnecting"
;
SSLOG
(
INFO
,
this
)
<<
"Disconnecting"
;
}
}
...
@@ -140,6 +140,10 @@ int Http2Session::disconnect() {
...
@@ -140,6 +140,10 @@ int Http2Session::disconnect() {
handlers
.
insert
(
dc
->
get_client_handler
());
handlers
.
insert
(
dc
->
get_client_handler
());
}
}
for
(
auto
h
:
handlers
)
{
for
(
auto
h
:
handlers
)
{
if
(
hard
)
{
delete
h
;
continue
;
}
if
(
h
->
get_upstream
()
->
on_downstream_reset
()
!=
0
)
{
if
(
h
->
get_upstream
()
->
on_downstream_reset
()
!=
0
)
{
delete
h
;
delete
h
;
}
}
...
@@ -271,13 +275,13 @@ void eventcb(bufferevent *bev, short events, void *ptr) {
...
@@ -271,13 +275,13 @@ void eventcb(bufferevent *bev, short events, void *ptr) {
if
(
!
get_config
()
->
downstream_no_tls
&&
!
get_config
()
->
insecure
&&
if
(
!
get_config
()
->
downstream_no_tls
&&
!
get_config
()
->
insecure
&&
http2session
->
check_cert
()
!=
0
)
{
http2session
->
check_cert
()
!=
0
)
{
http2session
->
disconnect
();
http2session
->
disconnect
(
true
);
return
;
return
;
}
}
if
(
http2session
->
on_connect
()
!=
0
)
{
if
(
http2session
->
on_connect
()
!=
0
)
{
http2session
->
disconnect
();
http2session
->
disconnect
(
true
);
return
;
return
;
}
}
...
@@ -296,7 +300,8 @@ void eventcb(bufferevent *bev, short events, void *ptr) {
...
@@ -296,7 +300,8 @@ void eventcb(bufferevent *bev, short events, void *ptr) {
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
SSLOG
(
INFO
,
http2session
)
<<
"EOF"
;
SSLOG
(
INFO
,
http2session
)
<<
"EOF"
;
}
}
http2session
->
disconnect
();
http2session
->
disconnect
(
http2session
->
get_state
()
==
Http2Session
::
CONNECTING
);
return
;
return
;
}
}
...
@@ -308,7 +313,8 @@ void eventcb(bufferevent *bev, short events, void *ptr) {
...
@@ -308,7 +313,8 @@ void eventcb(bufferevent *bev, short events, void *ptr) {
SSLOG
(
INFO
,
http2session
)
<<
"Timeout"
;
SSLOG
(
INFO
,
http2session
)
<<
"Timeout"
;
}
}
}
}
http2session
->
disconnect
();
http2session
->
disconnect
(
http2session
->
get_state
()
==
Http2Session
::
CONNECTING
);
return
;
return
;
}
}
}
}
...
@@ -364,7 +370,7 @@ void proxy_eventcb(bufferevent *bev, short events, void *ptr) {
...
@@ -364,7 +370,7 @@ void proxy_eventcb(bufferevent *bev, short events, void *ptr) {
}
}
if
(
bufferevent_write
(
bev
,
req
.
c_str
(),
req
.
size
())
!=
0
)
{
if
(
bufferevent_write
(
bev
,
req
.
c_str
(),
req
.
size
())
!=
0
)
{
SSLOG
(
ERROR
,
http2session
)
<<
"bufferevent_write() failed"
;
SSLOG
(
ERROR
,
http2session
)
<<
"bufferevent_write() failed"
;
http2session
->
disconnect
();
http2session
->
disconnect
(
true
);
}
}
return
;
return
;
}
}
...
@@ -373,7 +379,8 @@ void proxy_eventcb(bufferevent *bev, short events, void *ptr) {
...
@@ -373,7 +379,8 @@ void proxy_eventcb(bufferevent *bev, short events, void *ptr) {
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
SSLOG
(
INFO
,
http2session
)
<<
"Proxy EOF"
;
SSLOG
(
INFO
,
http2session
)
<<
"Proxy EOF"
;
}
}
http2session
->
disconnect
();
http2session
->
disconnect
(
http2session
->
get_state
()
==
Http2Session
::
PROXY_CONNECTING
);
return
;
return
;
}
}
...
@@ -385,7 +392,8 @@ void proxy_eventcb(bufferevent *bev, short events, void *ptr) {
...
@@ -385,7 +392,8 @@ void proxy_eventcb(bufferevent *bev, short events, void *ptr) {
SSLOG
(
INFO
,
http2session
)
<<
"Timeout"
;
SSLOG
(
INFO
,
http2session
)
<<
"Timeout"
;
}
}
}
}
http2session
->
disconnect
();
http2session
->
disconnect
(
http2session
->
get_state
()
==
Http2Session
::
PROXY_CONNECTING
);
return
;
return
;
}
}
}
}
...
...
src/shrpx_http2_session.h
View file @
556811ec
...
@@ -56,7 +56,9 @@ public:
...
@@ -56,7 +56,9 @@ public:
int
check_cert
();
int
check_cert
();
int
disconnect
();
// If hard is true, all pending requests are abandoned and
// associated ClientHandlers will be deleted.
int
disconnect
(
bool
hard
=
false
);
int
initiate_connection
();
int
initiate_connection
();
void
add_downstream_connection
(
Http2DownstreamConnection
*
dconn
);
void
add_downstream_connection
(
Http2DownstreamConnection
*
dconn
);
...
...
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