From 630edbebfc2f77ad29480d884e20d0b767883ac2 Mon Sep 17 00:00:00 2001
From: James Yonan <james@openvpn.net>
Date: Mon, 27 Feb 2017 13:01:26 -0700
Subject: =?UTF-8?q?Added=20user=20code=20hook=20async=5Fconnect=5Fpost=5Fo?=
 =?UTF-8?q?pen()=20to=20be=20called=0Aimmediately=20after=20socket=20open?=
 =?UTF-8?q?=20in=20async=5Fconnect.?=

---
 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 cbd9b35..dbc9297 100644
--- a/asio/include/asio/basic_socket.hpp
+++ b/asio/include/asio/basic_socket.hpp
@@ -866,6 +866,8 @@ public:
       asio::error_code ec;
       const protocol_type protocol = peer_endpoint.protocol();
       this->get_service().open(this->get_implementation(), protocol, ec);
+      if (!ec)
+	async_connect_post_open(protocol, ec);
       if (ec)
       {
         async_completion<ConnectHandler,
@@ -1742,6 +1744,11 @@ protected:
   }
 
 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;
-- 
1.8.5.2 (Apple Git-48)

