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
10181357
Commit
10181357
authored
Apr 06, 2016
by
octal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Http client will now reject the original Promise if it could send the request
parent
9bb6a2a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
16 deletions
+5
-16
src/client/client.cc
src/client/client.cc
+5
-16
No files found.
src/client/client.cc
View file @
10181357
...
...
@@ -542,30 +542,19 @@ Connection::performImpl(
timer
->
arm
(
timeout
);
}
auto
rejectClone
=
reject
.
clone
();
auto
rejectCloneMover
=
make_copy_mover
(
std
::
move
(
rejectClone
));
// Move the resolver and rejecter inside the lambda
auto
resolveMover
=
make_copy_mover
(
std
::
move
(
resolve
));
auto
rejectMover
=
make_copy_mover
(
std
::
move
(
reject
));
/*
* @Incomplete: currently, if the promise is rejected in asyncSendRequest,
* it will abort the current execution (NoExcept). Instead, it should reject
* the original promise from the request. The thing is that we currently can not
* do that since we transfered the ownership of the original rejecter to the
* mover so that it will be moved inside the continuation lambda.
*
* Since Resolver and Rejection objects are not copyable by default, we could
* implement a clone() member function so that it's explicit that a copy operation
* has been originated from the user
*
* The reason why Resolver and Rejection copy constructors is disabled is to avoid
* double-resolve and double-reject of a promise
*/
transport_
->
asyncSendRequest
(
shared_from_this
(),
timer
,
buffer
).
then
(
[
=
](
ssize_t
bytes
)
mutable
{
inflightRequests
.
push_back
(
RequestEntry
(
std
::
move
(
resolveMover
),
std
::
move
(
rejectMover
),
std
::
move
(
timer
),
std
::
move
(
onDone
)));
}
,
Async
::
NoExcept
);
}
,
[
=
](
std
::
exception_ptr
e
)
{
rejectCloneMover
.
val
(
e
);
}
);
}
void
...
...
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