aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/tls
diff options
context:
space:
mode:
authorHannes Rantzsch <[email protected]>2020-02-05 10:49:37 +0700
committerHannes Rantzsch <[email protected]>2020-03-16 22:20:14 +0700
commit6961c6dc06f60e60d45b3b37c54eeb61ce8f0e65 (patch)
treeae112ff9924c5c68053607781aba24d883caefe3 /src/lib/tls
parent23b625e761d3dd34af14ec71dc8b44794e71d604 (diff)
fail gracefully when using Stream w/o handshake
Diffstat (limited to 'src/lib/tls')
-rw-r--r--src/lib/tls/asio/asio_stream.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lib/tls/asio/asio_stream.h b/src/lib/tls/asio/asio_stream.h
index 4d2de0967..37f031571 100644
--- a/src/lib/tls/asio/asio_stream.h
+++ b/src/lib/tls/asio/asio_stream.h
@@ -113,7 +113,12 @@ class Stream
lowest_layer_type& lowest_layer() { return m_nextLayer.lowest_layer(); }
const lowest_layer_type& lowest_layer() const { return m_nextLayer.lowest_layer(); }
- native_handle_type native_handle() { return m_native_handle.get(); }
+ native_handle_type native_handle()
+ {
+ if(m_native_handle == nullptr)
+ { throw Invalid_State("Invalid handshake state"); }
+ return m_native_handle.get();
+ }
//! @}
//! \name configuration and callback setters