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
cf7f87c2
Commit
cf7f87c2
authored
Aug 25, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Log error code from getsockopt(SO_ERROR) on first write event
parent
bd0c1eda
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
11 deletions
+33
-11
src/shrpx_http2_session.cc
src/shrpx_http2_session.cc
+4
-2
src/shrpx_http_downstream_connection.cc
src/shrpx_http_downstream_connection.cc
+4
-2
src/shrpx_live_check.cc
src/shrpx_live_check.cc
+4
-2
src/shrpx_memcached_connection.cc
src/shrpx_memcached_connection.cc
+6
-5
src/util.cc
src/util.cc
+10
-0
src/util.h
src/util.h
+5
-0
No files found.
src/shrpx_http2_session.cc
View file @
cf7f87c2
...
...
@@ -1806,9 +1806,11 @@ int Http2Session::read_noop(const uint8_t *data, size_t datalen) { return 0; }
int
Http2Session
::
write_noop
()
{
return
0
;
}
int
Http2Session
::
connected
()
{
if
(
!
util
::
check_socket_connected
(
conn_
.
fd
))
{
auto
sock_error
=
util
::
get_socket_error
(
conn_
.
fd
);
if
(
sock_error
!=
0
)
{
SSLOG
(
WARN
,
this
)
<<
"Backend connect failed; addr="
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
);
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
)
<<
": errno="
<<
sock_error
;
downstream_failure
(
addr_
);
...
...
src/shrpx_http_downstream_connection.cc
View file @
cf7f87c2
...
...
@@ -1143,11 +1143,13 @@ int HttpDownstreamConnection::process_input(const uint8_t *data,
int
HttpDownstreamConnection
::
connected
()
{
auto
&
connect_blocker
=
addr_
->
connect_blocker
;
if
(
!
util
::
check_socket_connected
(
conn_
.
fd
))
{
auto
sock_error
=
util
::
get_socket_error
(
conn_
.
fd
);
if
(
sock_error
!=
0
)
{
conn_
.
wlimit
.
stopw
();
DCLOG
(
WARN
,
this
)
<<
"Backend connect failed; addr="
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
);
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
)
<<
": errno="
<<
sock_error
;
downstream_failure
(
addr_
);
...
...
src/shrpx_live_check.cc
View file @
cf7f87c2
...
...
@@ -259,10 +259,12 @@ int LiveCheck::initiate_connection() {
}
int
LiveCheck
::
connected
()
{
if
(
!
util
::
check_socket_connected
(
conn_
.
fd
))
{
auto
sock_error
=
util
::
get_socket_error
(
conn_
.
fd
);
if
(
sock_error
!=
0
)
{
if
(
LOG_ENABLED
(
INFO
))
{
LOG
(
INFO
)
<<
"Backend connect failed; addr="
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
);
<<
util
::
to_numeric_addr
(
&
addr_
->
addr
)
<<
": errno="
<<
sock_error
;
}
return
-
1
;
...
...
src/shrpx_memcached_connection.cc
View file @
cf7f87c2
...
...
@@ -203,15 +203,16 @@ int MemcachedConnection::initiate_connection() {
}
int
MemcachedConnection
::
connected
()
{
if
(
!
util
::
check_socket_connected
(
conn_
.
fd
))
{
auto
sock_error
=
util
::
get_socket_error
(
conn_
.
fd
);
if
(
sock_error
!=
0
)
{
MCLOG
(
WARN
,
this
)
<<
"memcached connect failed; addr="
<<
util
::
to_numeric_addr
(
addr_
)
<<
": errno="
<<
sock_error
;
connect_blocker_
.
on_failure
();
conn_
.
wlimit
.
stopw
();
if
(
LOG_ENABLED
(
INFO
))
{
MCLOG
(
INFO
,
this
)
<<
"memcached connect failed"
;
}
return
-
1
;
}
...
...
src/util.cc
View file @
cf7f87c2
...
...
@@ -893,6 +893,16 @@ bool check_socket_connected(int fd) {
return
error
==
0
;
}
int
get_socket_error
(
int
fd
)
{
int
error
;
socklen_t
len
=
sizeof
(
error
);
if
(
getsockopt
(
fd
,
SOL_SOCKET
,
SO_ERROR
,
&
error
,
&
len
)
!=
0
)
{
return
-
1
;
}
return
error
;
}
bool
ipv6_numeric_addr
(
const
char
*
host
)
{
uint8_t
dst
[
16
];
return
inet_pton
(
AF_INET6
,
host
,
dst
)
==
1
;
...
...
src/util.h
View file @
cf7f87c2
...
...
@@ -574,6 +574,11 @@ int create_nonblock_socket(int family);
bool
check_socket_connected
(
int
fd
);
// Returns the error code (errno) by inspecting SO_ERROR of given
// |fd|. This function returns the error code if it succeeds, or -1.
// Returning 0 means no error.
int
get_socket_error
(
int
fd
);
// Returns true if |host| is IPv6 numeric address (e.g., ::1)
bool
ipv6_numeric_addr
(
const
char
*
host
);
...
...
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