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
6c882e1e
Commit
6c882e1e
authored
Oct 20, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
asio: Avoid repeated call of io_service::post
parent
f09c5c4b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
src/asio_server_http2_handler.cc
src/asio_server_http2_handler.cc
+7
-2
src/asio_server_http2_handler.h
src/asio_server_http2_handler.h
+3
-0
No files found.
src/asio_server_http2_handler.cc
View file @
6c882e1e
...
...
@@ -245,6 +245,7 @@ http2_handler::http2_handler(boost::asio::io_service &io_service,
buf_
(
nullptr
),
buflen_
(
0
),
inside_callback_
(
false
),
write_signaled_
(
false
),
tstamp_cached_
(
time
(
nullptr
)),
formatted_date_
(
util
::
http_date
(
tstamp_cached_
))
{}
...
...
@@ -403,13 +404,17 @@ void http2_handler::stream_error(int32_t stream_id, uint32_t error_code) {
}
void
http2_handler
::
signal_write
()
{
if
(
!
inside_callback_
)
{
if
(
!
inside_callback_
&&
!
write_signaled_
)
{
write_signaled_
=
true
;
auto
self
=
shared_from_this
();
io_service_
.
post
([
self
]()
{
self
->
initiate_write
();
});
}
}
void
http2_handler
::
initiate_write
()
{
writefun_
();
}
void
http2_handler
::
initiate_write
()
{
write_signaled_
=
false
;
writefun_
();
}
void
http2_handler
::
resume
(
stream
&
strm
)
{
nghttp2_session_resume_data
(
session_
,
strm
.
get_stream_id
());
...
...
src/asio_server_http2_handler.h
View file @
6c882e1e
...
...
@@ -160,6 +160,9 @@ private:
const
uint8_t
*
buf_
;
std
::
size_t
buflen_
;
bool
inside_callback_
;
// true if we have pending on_write call. This avoids repeated call
// of io_service::post.
bool
write_signaled_
;
time_t
tstamp_cached_
;
std
::
string
formatted_date_
;
};
...
...
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