Add a AdHocSocketHandler::receive_multi overload

With only a single callback.
This commit is contained in:
Robbert van der Helm
2020-12-04 13:50:05 +01:00
parent ab7449a0e0
commit 19eb33a7e2
+12 -2
View File
@@ -542,8 +542,6 @@ class AdHocSocketHandler {
* same thing as `primary_callback`, but secondary sockets may need some
* different handling.
*
* TODO: Add an overload with a single callback
*
* @tparam F A function type in the form of
* `void(boost::asio::local::stream_protocol::socket&)`.
* @tparam G The same as `F`.
@@ -619,6 +617,18 @@ class AdHocSocketHandler {
acceptor.reset();
}
/**
* The same as the above, but with a single callback for incoming
* connections on the primary socket and on secondary sockets.
*
* @overload
*/
template <typename F>
void receive_multi(std::optional<std::pair<Logger&, bool>> logging,
F callback) {
receive_multi(logging, callback, callback);
}
private:
/**
* Used in `receive_multi()` to asynchronously listen for secondary socket