Created
September 1, 2016 19:34
-
-
Save mpenick/aa10b034eb77a2fa890a92541a09cd48 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/src/connection.cpp b/src/connection.cpp | |
| index 0123437..0d902dd 100644 | |
| --- a/src/connection.cpp | |
| +++ b/src/connection.cpp | |
| @@ -795,6 +795,7 @@ void Connection::on_supported(ResponseMessage* response) { | |
| // TODO(mstump) do something with the supported info | |
| (void)supported; | |
| + listener_->on_connect(this); // Allow the listener to inject a query before startup | |
| internal_write(new StartupHandler(this, new StartupRequest())); | |
| } | |
| diff --git a/src/connection.hpp b/src/connection.hpp | |
| index 6bdc298..2300baf 100644 | |
| --- a/src/connection.hpp | |
| +++ b/src/connection.hpp | |
| @@ -83,6 +83,7 @@ public: | |
| event_types_ = event_types; | |
| } | |
| + virtual void on_connect(Connection* connection) { } // Debug | |
| virtual void on_ready(Connection* connection) = 0; | |
| virtual void on_close(Connection* connection) = 0; | |
| virtual void on_availability_change(Connection* connection) = 0; | |
| diff --git a/src/control_connection.cpp b/src/control_connection.cpp | |
| index bbddffa..3946dab 100644 | |
| --- a/src/control_connection.cpp | |
| +++ b/src/control_connection.cpp | |
| @@ -206,6 +206,11 @@ void ControlConnection::reconnect(bool retry_current_host) { | |
| connection_->connect(); | |
| } | |
| +void ControlConnection::on_connect(Connection* connection) { | |
| + // Run a query before the connection had run the startup negotiation | |
| + refresh_node_info(current_host_, false); | |
| +} | |
| + | |
| void ControlConnection::on_ready(Connection* connection) { | |
| LOG_DEBUG("Connection ready on host %s", | |
| connection->address().to_string().c_str()); | |
| diff --git a/src/control_connection.hpp b/src/control_connection.hpp | |
| index 011e345..44bdb66 100644 | |
| --- a/src/control_connection.hpp | |
| +++ b/src/control_connection.hpp | |
| @@ -188,6 +188,7 @@ private: | |
| void reconnect(bool retry_current_host); | |
| // Connection listener methods | |
| + virtual void on_connect(Connection* connection); // Debug | |
| virtual void on_ready(Connection* connection); | |
| virtual void on_close(Connection* connection); | |
| virtual void on_availability_change(Connection* connection) {} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment