Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
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
pistache
Commits
8e34663b
Commit
8e34663b
authored
Nov 25, 2015
by
Mathieu Stefani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bunch of fixes for gcc < 4.9
parent
6362142f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
9 deletions
+40
-9
src/async.h
src/async.h
+16
-3
src/http.cc
src/http.cc
+18
-3
src/http.h
src/http.h
+6
-3
No files found.
src/async.h
View file @
8e34663b
...
...
@@ -758,10 +758,23 @@ namespace Async {
>
>
Promise
<
Results
>
whenAll
(
Args
&&
...
args
)
{
return
Promise
<
Results
>
([
&
](
Resolver
&
resolver
,
Rejection
&
rejection
)
{
Impl
::
WhenAll
impl
(
resolver
,
rejection
);
impl
(
std
::
forward
<
Args
>
(
args
)...);
// As ugly as it looks, this is needed to bypass a bug of gcc < 4.9
// whereby template parameters pack inside a lambda expression are not
// captured correctly and can not be expanded inside the lambda.
Resolver
*
resolve
;
Rejection
*
reject
;
Promise
<
Results
>
promise
([
&
](
Resolver
&
resolver
,
Rejection
&
rejection
)
{
resolve
=
&
resolver
;
reject
=
&
rejection
;
});
Impl
::
WhenAll
impl
(
*
resolve
,
*
reject
);
// So we capture everything we need inside the lambda and then call the
// implementation and expand the parameters pack here
impl
(
std
::
forward
<
Args
>
(
args
)...);
return
promise
;
}
template
<
...
...
src/http.cc
View file @
8e34663b
...
...
@@ -350,10 +350,25 @@ Request::query() const {
Response
::
Response
()
:
Message
()
,
bufSize
(
Const
::
MaxBuffer
<<
1
)
,
buffer_
(
new
char
[
bufSize
])
,
bufSize
_
(
Const
::
MaxBuffer
<<
1
)
,
buffer_
(
new
char
[
bufSize
_
])
{
}
Response
::
Response
(
Response
&&
other
)
:
peer_
(
other
.
peer_
)
,
bufSize_
(
other
.
bufSize_
)
,
buffer_
(
std
::
move
(
other
.
buffer_
))
{
}
Response
&
Response
::
operator
=
(
Response
&&
other
)
{
peer_
=
other
.
peer_
;
bufSize_
=
other
.
bufSize_
;
buffer_
=
std
::
move
(
other
.
buffer_
);
return
*
this
;
}
void
Response
::
associatePeer
(
const
std
::
shared_ptr
<
Tcp
::
Peer
>&
peer
)
{
...
...
@@ -373,7 +388,7 @@ Response::send(Code code, const std::string& body, const Mime::MediaType& mime)
{
char
*
beg
=
buffer_
.
get
();
Io
::
OutArrayBuf
obuf
(
beg
,
beg
+
bufSize
,
Io
::
Init
::
ZeroOut
);
Io
::
OutArrayBuf
obuf
(
beg
,
beg
+
bufSize
_
,
Io
::
Init
::
ZeroOut
);
std
::
ostream
stream
(
&
obuf
);
#define OUT(...) \
...
...
src/http.h
View file @
8e34663b
...
...
@@ -89,8 +89,11 @@ public:
Response
(
const
Response
&
other
)
=
delete
;
Response
&
operator
=
(
const
Response
&
other
)
=
delete
;
Response
(
Response
&&
other
)
=
default
;
Response
&
operator
=
(
Response
&&
other
)
=
default
;
// C++11: std::weak_ptr move constructor is C++14 only so the default
// version of move constructor / assignement operator does not work and we
// have to define it ourself
Response
(
Response
&&
other
);
Response
&
operator
=
(
Response
&&
other
);
Header
::
Collection
&
headers
();
const
Header
::
Collection
&
headers
()
const
;
...
...
@@ -108,7 +111,7 @@ private:
void
associatePeer
(
const
std
::
shared_ptr
<
Tcp
::
Peer
>&
peer
);
std
::
weak_ptr
<
Tcp
::
Peer
>
peer_
;
size_t
bufSize
;
size_t
bufSize
_
;
std
::
unique_ptr
<
char
[]
>
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