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
a37bc88f
Commit
a37bc88f
authored
Jan 19, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Rename ClientHandler::get_pending_write_length to get_outbuf_length
And other renames.
parent
bacea078
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
27 deletions
+25
-27
src/shrpx_client_handler.cc
src/shrpx_client_handler.cc
+2
-2
src/shrpx_client_handler.h
src/shrpx_client_handler.h
+1
-1
src/shrpx_http2_upstream.cc
src/shrpx_http2_upstream.cc
+8
-9
src/shrpx_https_upstream.cc
src/shrpx_https_upstream.cc
+6
-6
src/shrpx_spdy_upstream.cc
src/shrpx_spdy_upstream.cc
+8
-9
No files found.
src/shrpx_client_handler.cc
View file @
a37bc88f
...
...
@@ -60,7 +60,7 @@ void upstream_writecb(bufferevent *bev, void *arg)
{
auto
handler
=
reinterpret_cast
<
ClientHandler
*>
(
arg
);
// We actually depend on write low-warter mark == 0.
if
(
handler
->
get_
pending_write
_length
()
>
0
)
{
if
(
handler
->
get_
outbuf
_length
()
>
0
)
{
// Possibly because of deferred callback, we may get this callback
// when the output buffer is not empty.
return
;
...
...
@@ -449,7 +449,7 @@ DownstreamConnection* ClientHandler::get_downstream_connection()
}
}
size_t
ClientHandler
::
get_
pending_write
_length
()
size_t
ClientHandler
::
get_
outbuf
_length
()
{
auto
underlying
=
bufferevent_get_underlying
(
bev_
);
auto
len
=
evbuffer_get_length
(
bufferevent_get_output
(
bev_
));
...
...
src/shrpx_client_handler.h
View file @
a37bc88f
...
...
@@ -61,7 +61,7 @@ public:
void
pool_downstream_connection
(
DownstreamConnection
*
dconn
);
void
remove_downstream_connection
(
DownstreamConnection
*
dconn
);
DownstreamConnection
*
get_downstream_connection
();
size_t
get_
pending_write
_length
();
size_t
get_
outbuf
_length
();
SSL
*
get_ssl
()
const
;
void
set_http2_session
(
Http2Session
*
http2session
);
Http2Session
*
get_http2_session
()
const
;
...
...
src/shrpx_http2_upstream.cc
View file @
a37bc88f
...
...
@@ -45,7 +45,7 @@ using namespace nghttp2;
namespace
shrpx
{
namespace
{
const
size_t
SHRPX_HTTP2_UPSTREAM_OUTPUT_UPPER
_THRES
=
64
*
1024
;
const
size_t
OUTBUF_MAX
_THRES
=
64
*
1024
;
}
// namespace
namespace
{
...
...
@@ -59,8 +59,7 @@ ssize_t send_callback(nghttp2_session *session,
auto
bev
=
handler
->
get_bev
();
auto
output
=
bufferevent_get_output
(
bev
);
// Check buffer length and return WOULDBLOCK if it is large enough.
if
(
handler
->
get_pending_write_length
()
>
SHRPX_HTTP2_UPSTREAM_OUTPUT_UPPER_THRES
)
{
if
(
handler
->
get_outbuf_length
()
>
OUTBUF_MAX_THRES
)
{
return
NGHTTP2_ERR_WOULDBLOCK
;
}
...
...
@@ -595,7 +594,7 @@ int Http2Upstream::on_read()
}
if
(
nghttp2_session_want_read
(
session_
)
==
0
&&
nghttp2_session_want_write
(
session_
)
==
0
&&
handler_
->
get_
pending_write
_length
()
==
0
)
{
handler_
->
get_
outbuf
_length
()
==
0
)
{
if
(
LOG_ENABLED
(
INFO
))
{
ULOG
(
INFO
,
this
)
<<
"No more read/write for this HTTP2 session"
;
}
...
...
@@ -620,7 +619,7 @@ int Http2Upstream::send()
if
(
rv
==
0
)
{
if
(
nghttp2_session_want_read
(
session_
)
==
0
&&
nghttp2_session_want_write
(
session_
)
==
0
&&
handler_
->
get_
pending_write
_length
()
==
0
)
{
handler_
->
get_
outbuf
_length
()
==
0
)
{
if
(
LOG_ENABLED
(
INFO
))
{
ULOG
(
INFO
,
this
)
<<
"No more read/write for this HTTP2 session"
;
}
...
...
@@ -907,8 +906,8 @@ ssize_t downstream_data_read_callback(nghttp2_session *session,
// Send WINDOW_UPDATE before buffer is empty to avoid delay because
// of RTT.
if
(
*
eof
!=
1
&&
handler
->
get_
pending_write
_length
()
+
evbuffer_get_length
(
body
)
<
SHRPX_HTTP2_UPSTREAM_OUTPUT_UPPER
_THRES
)
{
handler
->
get_
outbuf
_length
()
+
evbuffer_get_length
(
body
)
<
OUTBUF_MAX
_THRES
)
{
if
(
downstream
->
resume_read
(
SHRPX_NO_BUFFER
)
!=
0
)
{
return
NGHTTP2_ERR_CALLBACK_FAILURE
;
}
...
...
@@ -1086,9 +1085,9 @@ int Http2Upstream::on_downstream_body(Downstream *downstream,
}
nghttp2_session_resume_data
(
session_
,
downstream
->
get_stream_id
());
auto
outbuflen
=
handler
->
get_
pending_write
_length
()
+
auto
outbuflen
=
handler
->
get_
outbuf
_length
()
+
evbuffer_get_length
(
body
);
if
(
outbuflen
>
SHRPX_HTTP2_UPSTREAM_OUTPUT_UPPER
_THRES
)
{
if
(
outbuflen
>
OUTBUF_MAX
_THRES
)
{
downstream
->
pause_read
(
SHRPX_NO_BUFFER
);
}
...
...
src/shrpx_https_upstream.cc
View file @
a37bc88f
...
...
@@ -44,7 +44,7 @@ using namespace nghttp2;
namespace
shrpx
{
namespace
{
const
size_t
SHRPX_HTTPS_UPSTREAM_OUTPUT_UPPER
_THRES
=
64
*
1024
;
const
size_t
OUTBUF_MAX
_THRES
=
64
*
1024
;
const
size_t
SHRPX_HTTPS_MAX_HEADER_LENGTH
=
64
*
1024
;
}
// namespace
...
...
@@ -414,7 +414,7 @@ void https_downstream_readcb(bufferevent *bev, void *ptr)
auto
handler
=
upstream
->
get_client_handler
();
if
(
downstream
->
get_request_state
()
==
Downstream
::
MSG_COMPLETE
)
{
if
(
handler
->
get_should_close_after_write
()
&&
handler
->
get_
pending_write
_length
()
==
0
)
{
handler
->
get_
outbuf
_length
()
==
0
)
{
// If all upstream response body has already written out to
// the peer, we cannot use writecb for ClientHandler. In
// this case, we just delete handler here.
...
...
@@ -435,7 +435,7 @@ void https_downstream_readcb(bufferevent *bev, void *ptr)
// https_downstream_eventcb.
//
// Tunneled connection always indicates connection close.
if
(
handler
->
get_
pending_write
_length
()
==
0
)
{
if
(
handler
->
get_
outbuf
_length
()
==
0
)
{
// For tunneled connection, if there is no pending data,
// delete handler because on_write will not be called.
delete
handler
;
...
...
@@ -446,8 +446,8 @@ void https_downstream_readcb(bufferevent *bev, void *ptr)
}
}
}
else
{
if
(
upstream
->
get_client_handler
()
->
get_
pending_write
_length
()
>
SHRPX_HTTPS_UPSTREAM_OUTPUT_UPPER
_THRES
)
{
if
(
upstream
->
get_client_handler
()
->
get_
outbuf
_length
()
>
OUTBUF_MAX
_THRES
)
{
downstream
->
pause_read
(
SHRPX_NO_BUFFER
);
}
}
...
...
@@ -514,7 +514,7 @@ void https_downstream_eventcb(bufferevent *bev, short events, void *ptr)
auto
handler
=
upstream
->
get_client_handler
();
if
(
handler
->
get_should_close_after_write
()
&&
handler
->
get_
pending_write
_length
()
==
0
)
{
handler
->
get_
outbuf
_length
()
==
0
)
{
// If all upstream response body has already written out to
// the peer, we cannot use writecb for ClientHandler. In this
// case, we just delete handler here.
...
...
src/shrpx_spdy_upstream.cc
View file @
a37bc88f
...
...
@@ -45,7 +45,7 @@ using namespace nghttp2;
namespace
shrpx
{
namespace
{
const
size_t
SHRPX_SPDY_UPSTREAM_OUTPUT_UPPER
_THRES
=
64
*
1024
;
const
size_t
OUTBUF_MAX
_THRES
=
64
*
1024
;
}
// namespace
namespace
{
...
...
@@ -59,8 +59,7 @@ ssize_t send_callback(spdylay_session *session,
auto
bev
=
handler
->
get_bev
();
auto
output
=
bufferevent_get_output
(
bev
);
// Check buffer length and return WOULDBLOCK if it is large enough.
if
(
handler
->
get_pending_write_length
()
>
SHRPX_SPDY_UPSTREAM_OUTPUT_UPPER_THRES
)
{
if
(
handler
->
get_outbuf_length
()
>
OUTBUF_MAX_THRES
)
{
return
SPDYLAY_ERR_WOULDBLOCK
;
}
...
...
@@ -452,7 +451,7 @@ int SpdyUpstream::on_read()
if
(
rv
==
0
)
{
if
(
spdylay_session_want_read
(
session_
)
==
0
&&
spdylay_session_want_write
(
session_
)
==
0
&&
handler_
->
get_
pending_write
_length
()
==
0
)
{
handler_
->
get_
outbuf
_length
()
==
0
)
{
if
(
LOG_ENABLED
(
INFO
))
{
ULOG
(
INFO
,
this
)
<<
"No more read/write for this SPDY session"
;
}
...
...
@@ -478,7 +477,7 @@ int SpdyUpstream::send()
if
(
rv
==
0
)
{
if
(
spdylay_session_want_read
(
session_
)
==
0
&&
spdylay_session_want_write
(
session_
)
==
0
&&
handler_
->
get_
pending_write
_length
()
==
0
)
{
handler_
->
get_
outbuf
_length
()
==
0
)
{
if
(
LOG_ENABLED
(
INFO
))
{
ULOG
(
INFO
,
this
)
<<
"No more read/write for this SPDY session"
;
}
...
...
@@ -751,8 +750,8 @@ ssize_t spdy_data_read_callback(spdylay_session *session,
// Send WINDOW_UPDATE before buffer is empty to avoid delay because
// of RTT.
if
(
*
eof
!=
1
&&
handler
->
get_
pending_write
_length
()
+
evbuffer_get_length
(
body
)
<
SHRPX_SPDY_UPSTREAM_OUTPUT_UPPER
_THRES
)
{
handler
->
get_
outbuf
_length
()
+
evbuffer_get_length
(
body
)
<
OUTBUF_MAX
_THRES
)
{
if
(
downstream
->
resume_read
(
SHRPX_NO_BUFFER
)
!=
0
)
{
return
SPDYLAY_ERR_CALLBACK_FAILURE
;
}
...
...
@@ -931,9 +930,9 @@ int SpdyUpstream::on_downstream_body(Downstream *downstream,
}
spdylay_session_resume_data
(
session_
,
downstream
->
get_stream_id
());
auto
outbuflen
=
upstream
->
get_client_handler
()
->
get_
pending_write
_length
()
+
auto
outbuflen
=
upstream
->
get_client_handler
()
->
get_
outbuf
_length
()
+
evbuffer_get_length
(
body
);
if
(
outbuflen
>
SHRPX_SPDY_UPSTREAM_OUTPUT_UPPER
_THRES
)
{
if
(
outbuflen
>
OUTBUF_MAX
_THRES
)
{
downstream
->
pause_read
(
SHRPX_NO_BUFFER
);
}
...
...
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