Expose TLS handle

This commit is contained in:
Dominik Epple 2019-11-25 14:54:23 +01:00
parent 2d5f76594a
commit 7441429365
4 changed files with 11 additions and 0 deletions

View File

@ -140,6 +140,13 @@ void session::read_timeout(const boost::posix_time::time_duration &t) {
impl_->read_timeout(t); impl_->read_timeout(t);
} }
SSL *session::tls_native_handle() {
if(session_tls_impl* i=dynamic_cast<session_tls_impl*>(impl_.get())) {
return i->native_handle();
}
return nullptr;
}
priority_spec::priority_spec(const int32_t stream_id, const int32_t weight, priority_spec::priority_spec(const int32_t stream_id, const int32_t weight,
const bool exclusive) const bool exclusive)
: valid_(true) { : valid_(true) {

View File

@ -86,6 +86,8 @@ void session_tls_impl::start_connect(tcp::resolver::iterator endpoint_it) {
tcp::socket &session_tls_impl::socket() { return socket_.next_layer(); } tcp::socket &session_tls_impl::socket() { return socket_.next_layer(); }
SSL *session_tls_impl::native_handle() { return socket_.native_handle(); }
void session_tls_impl::read_socket( void session_tls_impl::read_socket(
std::function<void(const boost::system::error_code &ec, std::size_t n)> h) { std::function<void(const boost::system::error_code &ec, std::size_t n)> h) {
socket_.async_read_some(boost::asio::buffer(rb_), h); socket_.async_read_some(boost::asio::buffer(rb_), h);

View File

@ -47,6 +47,7 @@ public:
virtual void start_connect(tcp::resolver::iterator endpoint_it); virtual void start_connect(tcp::resolver::iterator endpoint_it);
virtual tcp::socket &socket(); virtual tcp::socket &socket();
virtual SSL* native_handle();
virtual void read_socket( virtual void read_socket(
std::function<void(const boost::system::error_code &ec, std::size_t n)> std::function<void(const boost::system::error_code &ec, std::size_t n)>
h); h);

View File

@ -233,6 +233,7 @@ public:
generator_cb cb, header_map h = header_map{}, generator_cb cb, header_map h = header_map{},
priority_spec prio = priority_spec()) const; priority_spec prio = priority_spec()) const;
SSL *tls_native_handle();
private: private:
std::shared_ptr<session_impl> impl_; std::shared_ptr<session_impl> impl_;
}; };