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
f0fc0267
Commit
f0fc0267
authored
Jan 25, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shrpx: Check return value of library functions
parent
9f28b305
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
8 deletions
+28
-8
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+8
-2
src/shrpx_listen_handler.cc
src/shrpx_listen_handler.cc
+4
-1
src/shrpx_spdy_session.cc
src/shrpx_spdy_session.cc
+5
-2
src/shrpx_spdy_upstream.cc
src/shrpx_spdy_upstream.cc
+5
-2
src/shrpx_thread_event_receiver.cc
src/shrpx_thread_event_receiver.cc
+6
-1
No files found.
src/shrpx_https_upstream.cc
View file @
f0fc0267
...
@@ -681,9 +681,15 @@ int HttpsUpstream::on_downstream_body(Downstream *downstream,
...
@@ -681,9 +681,15 @@ int HttpsUpstream::on_downstream_body(Downstream *downstream,
return
-
1
;
return
-
1
;
}
}
}
}
evbuffer_add
(
output
,
data
,
len
);
if
(
evbuffer_add
(
output
,
data
,
len
)
!=
0
)
{
ULOG
(
FATAL
,
this
)
<<
"evbuffer_add() failed"
;
return
-
1
;
}
if
(
downstream
->
get_chunked_response
())
{
if
(
downstream
->
get_chunked_response
())
{
evbuffer_add
(
output
,
"
\r\n
"
,
2
);
if
(
evbuffer_add
(
output
,
"
\r\n
"
,
2
)
!=
0
)
{
ULOG
(
FATAL
,
this
)
<<
"evbuffer_add() failed"
;
return
-
1
;
}
}
}
return
0
;
return
0
;
}
}
...
...
src/shrpx_listen_handler.cc
View file @
f0fc0267
...
@@ -109,7 +109,10 @@ int ListenHandler::accept_connection(evutil_socket_t fd,
...
@@ -109,7 +109,10 @@ int ListenHandler::accept_connection(evutil_socket_t fd,
memcpy
(
&
wev
.
client_addr
,
addr
,
addrlen
);
memcpy
(
&
wev
.
client_addr
,
addr
,
addrlen
);
wev
.
client_addrlen
=
addrlen
;
wev
.
client_addrlen
=
addrlen
;
evbuffer
*
output
=
bufferevent_get_output
(
workers_
[
idx
].
bev
);
evbuffer
*
output
=
bufferevent_get_output
(
workers_
[
idx
].
bev
);
evbuffer_add
(
output
,
&
wev
,
sizeof
(
wev
));
if
(
evbuffer_add
(
output
,
&
wev
,
sizeof
(
wev
))
!=
0
)
{
LLOG
(
FATAL
,
this
)
<<
"evbuffer_add() failed"
;
return
-
1
;
}
}
}
return
0
;
return
0
;
}
}
...
...
src/shrpx_spdy_session.cc
View file @
f0fc0267
...
@@ -228,8 +228,11 @@ void eventcb(bufferevent *bev, short events, void *ptr)
...
@@ -228,8 +228,11 @@ void eventcb(bufferevent *bev, short events, void *ptr)
}
}
int
fd
=
bufferevent_getfd
(
bev
);
int
fd
=
bufferevent_getfd
(
bev
);
int
val
=
1
;
int
val
=
1
;
setsockopt
(
fd
,
IPPROTO_TCP
,
TCP_NODELAY
,
if
(
setsockopt
(
fd
,
IPPROTO_TCP
,
TCP_NODELAY
,
reinterpret_cast
<
char
*>
(
&
val
),
sizeof
(
val
));
reinterpret_cast
<
char
*>
(
&
val
),
sizeof
(
val
))
==
-
1
)
{
SSLOG
(
WARNING
,
spdy
)
<<
"Setting option TCP_NODELAY failed: "
<<
strerror
(
errno
);
}
}
else
if
(
events
&
BEV_EVENT_EOF
)
{
}
else
if
(
events
&
BEV_EVENT_EOF
)
{
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
SSLOG
(
INFO
,
spdy
)
<<
"EOF"
;
SSLOG
(
INFO
,
spdy
)
<<
"EOF"
;
...
...
src/shrpx_spdy_upstream.cc
View file @
f0fc0267
...
@@ -508,8 +508,11 @@ void spdy_downstream_eventcb(bufferevent *bev, short events, void *ptr)
...
@@ -508,8 +508,11 @@ void spdy_downstream_eventcb(bufferevent *bev, short events, void *ptr)
}
}
int
fd
=
bufferevent_getfd
(
bev
);
int
fd
=
bufferevent_getfd
(
bev
);
int
val
=
1
;
int
val
=
1
;
setsockopt
(
fd
,
IPPROTO_TCP
,
TCP_NODELAY
,
if
(
setsockopt
(
fd
,
IPPROTO_TCP
,
TCP_NODELAY
,
reinterpret_cast
<
char
*>
(
&
val
),
sizeof
(
val
));
reinterpret_cast
<
char
*>
(
&
val
),
sizeof
(
val
))
==
-
1
)
{
DCLOG
(
WARNING
,
dconn
)
<<
"Setting option TCP_NODELAY failed: "
<<
strerror
(
errno
);
}
}
else
if
(
events
&
BEV_EVENT_EOF
)
{
}
else
if
(
events
&
BEV_EVENT_EOF
)
{
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
DCLOG
(
INFO
,
dconn
)
<<
"EOF. stream_id="
<<
downstream
->
get_stream_id
();
DCLOG
(
INFO
,
dconn
)
<<
"EOF. stream_id="
<<
downstream
->
get_stream_id
();
...
...
src/shrpx_thread_event_receiver.cc
View file @
f0fc0267
...
@@ -46,7 +46,12 @@ void ThreadEventReceiver::on_read(bufferevent *bev)
...
@@ -46,7 +46,12 @@ void ThreadEventReceiver::on_read(bufferevent *bev)
evbuffer
*
input
=
bufferevent_get_input
(
bev
);
evbuffer
*
input
=
bufferevent_get_input
(
bev
);
while
(
evbuffer_get_length
(
input
)
>=
sizeof
(
WorkerEvent
))
{
while
(
evbuffer_get_length
(
input
)
>=
sizeof
(
WorkerEvent
))
{
WorkerEvent
wev
;
WorkerEvent
wev
;
evbuffer_remove
(
input
,
&
wev
,
sizeof
(
WorkerEvent
));
int
nread
=
evbuffer_remove
(
input
,
&
wev
,
sizeof
(
wev
));
if
(
nread
!=
sizeof
(
wev
))
{
TLOG
(
FATAL
,
this
)
<<
"evbuffer_remove() removed fewer bytes. Expected:"
<<
sizeof
(
wev
)
<<
" Actual:"
<<
nread
;
continue
;
}
if
(
LOG_ENABLED
(
INFO
))
{
if
(
LOG_ENABLED
(
INFO
))
{
TLOG
(
INFO
,
this
)
<<
"WorkerEvent: client_fd="
<<
wev
.
client_fd
TLOG
(
INFO
,
this
)
<<
"WorkerEvent: client_fd="
<<
wev
.
client_fd
<<
", addrlen="
<<
wev
.
client_addrlen
;
<<
", addrlen="
<<
wev
.
client_addrlen
;
...
...
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