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
bc3949db
Commit
bc3949db
authored
Apr 11, 2017
by
Matt Way
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support specifying stream priority via session::submit()
parent
899588e0
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
12 deletions
+56
-12
src/asio_client_session.cc
src/asio_client_session.cc
+25
-6
src/asio_client_session_impl.cc
src/asio_client_session_impl.cc
+2
-2
src/asio_client_session_impl.h
src/asio_client_session_impl.h
+1
-1
src/includes/nghttp2/asio_http2_client.h
src/includes/nghttp2/asio_http2_client.h
+28
-3
No files found.
src/asio_client_session.cc
View file @
bc3949db
...
@@ -96,29 +96,48 @@ boost::asio::io_service &session::io_service() const {
...
@@ -96,29 +96,48 @@ boost::asio::io_service &session::io_service() const {
const
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
header_map
h
)
const
{
const
std
::
string
&
uri
,
header_map
h
,
return
impl_
->
submit
(
ec
,
method
,
uri
,
generator_cb
(),
std
::
move
(
h
));
priority_spec
prio
)
const
{
return
impl_
->
submit
(
ec
,
method
,
uri
,
generator_cb
(),
std
::
move
(
h
),
std
::
move
(
prio
));
}
}
const
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
std
::
string
data
,
const
std
::
string
&
uri
,
std
::
string
data
,
header_map
h
)
const
{
header_map
h
,
priority_spec
prio
)
const
{
return
impl_
->
submit
(
ec
,
method
,
uri
,
string_generator
(
std
::
move
(
data
)),
return
impl_
->
submit
(
ec
,
method
,
uri
,
string_generator
(
std
::
move
(
data
)),
std
::
move
(
h
));
std
::
move
(
h
)
,
std
::
move
(
prio
)
);
}
}
const
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
session
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
generator_cb
cb
,
const
std
::
string
&
uri
,
generator_cb
cb
,
header_map
h
)
const
{
header_map
h
,
priority_spec
prio
)
const
{
return
impl_
->
submit
(
ec
,
method
,
uri
,
std
::
move
(
cb
),
std
::
move
(
h
));
return
impl_
->
submit
(
ec
,
method
,
uri
,
std
::
move
(
cb
),
std
::
move
(
h
),
std
::
move
(
prio
));
}
}
void
session
::
read_timeout
(
const
boost
::
posix_time
::
time_duration
&
t
)
{
void
session
::
read_timeout
(
const
boost
::
posix_time
::
time_duration
&
t
)
{
impl_
->
read_timeout
(
t
);
impl_
->
read_timeout
(
t
);
}
}
priority_spec
::
priority_spec
(
const
int32_t
stream_id
,
const
int32_t
weight
,
const
bool
exclusive
)
:
valid_
(
true
)
{
nghttp2_priority_spec_init
(
&
spec_
,
stream_id
,
weight
,
exclusive
);
}
const
nghttp2_priority_spec
*
priority_spec
::
get
()
const
{
if
(
!
valid_
)
{
return
nullptr
;
}
return
&
spec_
;
}
const
bool
priority_spec
::
valid
()
const
{
return
valid_
;
}
}
// namespace client
}
// namespace client
}
// namespace asio_http2
}
// namespace asio_http2
}
// nghttp2
}
// nghttp2
src/asio_client_session_impl.cc
View file @
bc3949db
...
@@ -479,7 +479,7 @@ std::unique_ptr<stream> session_impl::create_stream() {
...
@@ -479,7 +479,7 @@ std::unique_ptr<stream> session_impl::create_stream() {
const
request
*
session_impl
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
session_impl
::
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
generator_cb
cb
,
const
std
::
string
&
uri
,
generator_cb
cb
,
header_map
h
)
{
header_map
h
,
priority_spec
prio
)
{
ec
.
clear
();
ec
.
clear
();
if
(
stopped_
)
{
if
(
stopped_
)
{
...
@@ -559,7 +559,7 @@ const request *session_impl::submit(boost::system::error_code &ec,
...
@@ -559,7 +559,7 @@ const request *session_impl::submit(boost::system::error_code &ec,
prdptr
=
&
prd
;
prdptr
=
&
prd
;
}
}
auto
stream_id
=
nghttp2_submit_request
(
session_
,
nullptr
,
nva
.
data
(),
auto
stream_id
=
nghttp2_submit_request
(
session_
,
prio
.
get
()
,
nva
.
data
(),
nva
.
size
(),
prdptr
,
strm
.
get
());
nva
.
size
(),
prdptr
,
strm
.
get
());
if
(
stream_id
<
0
)
{
if
(
stream_id
<
0
)
{
ec
=
make_error_code
(
static_cast
<
nghttp2_error
>
(
stream_id
));
ec
=
make_error_code
(
static_cast
<
nghttp2_error
>
(
stream_id
));
...
...
src/asio_client_session_impl.h
View file @
bc3949db
...
@@ -70,7 +70,7 @@ public:
...
@@ -70,7 +70,7 @@ public:
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
generator_cb
cb
,
header_map
h
);
generator_cb
cb
,
header_map
h
,
priority_spec
spec
);
virtual
void
start_connect
(
tcp
::
resolver
::
iterator
endpoint_it
)
=
0
;
virtual
void
start_connect
(
tcp
::
resolver
::
iterator
endpoint_it
)
=
0
;
virtual
tcp
::
socket
&
socket
()
=
0
;
virtual
tcp
::
socket
&
socket
()
=
0
;
...
...
src/includes/nghttp2/asio_http2_client.h
View file @
bc3949db
...
@@ -118,6 +118,28 @@ private:
...
@@ -118,6 +118,28 @@ private:
std
::
unique_ptr
<
request_impl
>
impl_
;
std
::
unique_ptr
<
request_impl
>
impl_
;
};
};
// Wrapper around an nghttp2_priority_spec.
class
priority_spec
{
public:
// The default ctor is used only by sentinel values.
priority_spec
()
=
default
;
// Create a priority spec with the given priority settings.
explicit
priority_spec
(
const
int32_t
stream_id
,
const
int32_t
weight
,
const
bool
exclusive
=
false
);
// Return a pointer to a valid nghttp2 priority spec, or null.
const
nghttp2_priority_spec
*
get
()
const
;
// Indicates whether or not this spec is valid (i.e. was constructed with
// values).
const
bool
valid
()
const
;
private:
nghttp2_priority_spec
spec_
;
bool
valid_
=
false
;
};
class
session_impl
;
class
session_impl
;
class
session
{
class
session
{
...
@@ -177,7 +199,8 @@ public:
...
@@ -177,7 +199,8 @@ public:
// succeeds, or nullptr and |ec| contains error message.
// succeeds, or nullptr and |ec| contains error message.
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
header_map
h
=
header_map
{})
const
;
header_map
h
=
header_map
{},
priority_spec
prio
=
priority_spec
())
const
;
// Submits request to server using |method| (e.g., "GET"), |uri|
// Submits request to server using |method| (e.g., "GET"), |uri|
// (e.g., "http://localhost/") and optionally additional header
// (e.g., "http://localhost/") and optionally additional header
...
@@ -186,7 +209,8 @@ public:
...
@@ -186,7 +209,8 @@ public:
// contains error message.
// contains error message.
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
std
::
string
data
,
header_map
h
=
header_map
{})
const
;
std
::
string
data
,
header_map
h
=
header_map
{},
priority_spec
prio
=
priority_spec
())
const
;
// Submits request to server using |method| (e.g., "GET"), |uri|
// Submits request to server using |method| (e.g., "GET"), |uri|
// (e.g., "http://localhost/") and optionally additional header
// (e.g., "http://localhost/") and optionally additional header
...
@@ -195,7 +219,8 @@ public:
...
@@ -195,7 +219,8 @@ public:
// nullptr and |ec| contains error message.
// nullptr and |ec| contains error message.
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
request
*
submit
(
boost
::
system
::
error_code
&
ec
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
const
std
::
string
&
method
,
const
std
::
string
&
uri
,
generator_cb
cb
,
header_map
h
=
header_map
{})
const
;
generator_cb
cb
,
header_map
h
=
header_map
{},
priority_spec
prio
=
priority_spec
())
const
;
private:
private:
std
::
shared_ptr
<
session_impl
>
impl_
;
std
::
shared_ptr
<
session_impl
>
impl_
;
...
...
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