-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor handshake #77
Open
jens-diewald
wants to merge
12
commits into
laudrup:master
Choose a base branch
from
jens-diewald:refactor-handshake
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
eab1d14
Move manual_auth out of the handshake loop.
jens-diewald 66a435c
Also send leftover handshake data as client.
jens-diewald 4ba64de
Remove unused member from async_handshake
jens-diewald 88ce93c
Remove redundant code
jens-diewald b437f7a
Make async_handshake::operator() not be a coroutine
jens-diewald 9971739
Revert "Make async_handshake::operator() not be a coroutine"
jens-diewald 0d8b104
Make use of async_handshake being a coroutine
jens-diewald c6bb0b0
Simplify code and add comment
jens-diewald fd3aea5
Improve handling of immediately failing async operations
jens-diewald 7243bad
Add Boost 1.80 and Boost 1.81 to CI Unittests
jens-diewald 12aec4a
Set toolset for new boost versions and install-boost
jens-diewald 269342b
Increase waiting time for OCSP responder in test
jens-diewald File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// Copyright (c) 2020 Kasper Laudrup (laudrup at stacktrace dot dk) | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
// | ||
|
||
#ifndef BOOST_WINTLS_DETAIL_POST_SELF_HPP | ||
#define BOOST_WINTLS_DETAIL_POST_SELF_HPP | ||
|
||
#if BOOST_VERSION >= 108000 | ||
#include <boost/asio/append.hpp> | ||
#endif | ||
#include <boost/asio/post.hpp> | ||
#include <boost/core/ignore_unused.hpp> | ||
#include <boost/version.hpp> | ||
|
||
namespace boost { | ||
namespace wintls { | ||
namespace detail { | ||
|
||
// If a composed asynchronous operation completes immediately (due to an error) | ||
// we do not want to call self.complete() directly as this may produce an infinite recursion in some cases. | ||
// Instead, we post the intermediate completion handler (self) once. | ||
// To achieve consistent behavior to non-erroneous cases, we post to the executor of the I/O object. | ||
// Note that this only got accessible through self by get_io_executor since boost 1.81. | ||
template<typename Self, typename IoObject, typename... Args> | ||
auto post_self(Self& self, IoObject& io_object, boost::system::error_code ec, std::size_t length) { | ||
#if BOOST_VERSION >= 108100 | ||
boost::ignore_unused(io_object); | ||
auto ex = self.get_io_executor(); | ||
return boost::asio::post(ex, boost::asio::append(std::move(self), ec, length)); | ||
#elif BOOST_VERSION >= 108000 | ||
return boost::asio::post(io_object.get_executor(), boost::asio::append(std::move(self), ec, length)); | ||
#else | ||
auto ex = io_object.get_executor(); | ||
// If the completion token associated with self had an associated executor, | ||
// allocator or cancellation slot, we loose these here. | ||
// Therefore, above solutions are better! | ||
return boost::asio::post(ex, [self = std::move(self), ec, length]() mutable { self(ec, length); }); | ||
#endif | ||
} | ||
|
||
} // namespace detail | ||
} // namespace wintls | ||
} // namespace boost | ||
|
||
#endif //BOOST_WINTLS_DETAIL_POST_SELF_HPP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this supposed to return
void
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a small lambda that returns bool.
Although i do not know why this is a lambda and not a simple bool variable. Technically, even the entry_count_ member could be a bool i suppose.
Then again, looking into the source of asio::detail::composed_op, it seems that it keeps track of its invocations itself and that we could access that via
asio::asio_handler_is_continuation(&self)
. Is that how it should be done?