Skip to content
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

session constructor that allows setting the callbacks before start_resolve is called #14

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/asio_client_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ session::session(boost::asio::io_service &io_service, const std::string &host,
impl_->start_resolve(host, service);
}

session::session(boost::asio::io_service &io_service, const std::string &host,
const std::string &service,
connect_cb ccb,
error_cb ecb)
: impl_(std::make_shared<session_tcp_impl>(
io_service, host, service, boost::posix_time::seconds(60))) {
impl_->on_connect(std::move(ccb));
impl_->on_error(std::move(ecb));
impl_->start_resolve(host, service);
}

session::session(boost::asio::io_service &io_service,
const boost::asio::ip::tcp::endpoint &local_endpoint,
const std::string &host, const std::string &service)
Expand Down
5 changes: 5 additions & 0 deletions lib/includes/nghttp2/asio_http2_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ class session {
session(boost::asio::io_service &io_service, const std::string &host,
const std::string &service);

session(boost::asio::io_service &io_service, const std::string &host,
const std::string &service,
connect_cb ccb,
error_cb ecb);

// Same as previous but with pegged local endpoint
session(boost::asio::io_service &io_service,
const boost::asio::ip::tcp::endpoint &local_endpoint,
Expand Down