From 80485636d5140c4b45679a4664eb7fe9e09f574f Mon Sep 17 00:00:00 2001 From: James Yonan Date: Mon, 27 Feb 2017 13:01:26 -0700 Subject: [PATCH] Added user code hook async_connect_post_open() to be called immediately after socket open in async_connect. --- asio/include/asio/basic_socket.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/asio/include/asio/basic_socket.hpp b/asio/include/asio/basic_socket.hpp index 42efbda4..4da85eb6 100644 --- a/asio/include/asio/basic_socket.hpp +++ b/asio/include/asio/basic_socket.hpp @@ -950,6 +950,8 @@ public: { const protocol_type protocol = peer_endpoint.protocol(); impl_.get_service().open(impl_.get_implementation(), protocol, open_ec); + if (!open_ec) + async_connect_post_open(protocol, open_ec); } return async_initiate( @@ -1800,6 +1802,11 @@ protected: #endif private: + // optional user code hook immediately after socket open in async_connect + virtual void async_connect_post_open(const protocol_type& protocol, asio::error_code& ec) + { + } + // Disallow copying and assignment. basic_socket(const basic_socket&) ASIO_DELETED; basic_socket& operator=(const basic_socket&) ASIO_DELETED; -- 2.21.0