1- /* Copyright (c) 2016, 2017 , Oracle and/or its affiliates. All rights reserved.
1+ /* Copyright (c) 2016, 2018 , Oracle and/or its affiliates. All rights reserved.
22
33 This program is free software; you can redistribute it and/or modify
44 it under the terms of the GNU General Public License, version 2.0,
2020 along with this program; if not, write to the Free Software
2121 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
2222
23- #define LOG_SUBSYSTEM_TAG " CONNECTION_CONTROL"
24-
2523#include " plugin/connection_control/connection_control.h"
2624
2725#include < mysql/plugin_audit.h> /* mysql_event_connection */
@@ -45,16 +43,13 @@ namespace connection_control
4543 class Connection_control_error_handler : public Error_handler
4644 {
4745 public:
48- Connection_control_error_handler (MYSQL_PLUGIN plugin_info)
49- : m_plugin_info(plugin_info)
50- {}
51-
52- void handle_error (const char * error_message)
46+ void handle_error (longlong errcode, ...)
5347 {
54- LogPluginErr (ERROR_LEVEL, ER_CONN_CONTROL_ERROR_MSG, error_message);
48+ va_list vl;
49+ va_start (vl, errcode);
50+ LogPluginErrV (ERROR_LEVEL, errcode, vl);
51+ va_end (vl);
5552 }
56- private:
57- MYSQL_PLUGIN m_plugin_info;
5853 };
5954}
6055
@@ -96,7 +91,7 @@ connection_control_notify(MYSQL_THD thd,
9691 {
9792 const struct mysql_event_connection *connection_event=
9893 (const struct mysql_event_connection *) event;
99- Connection_control_error_handler error_handler (connection_control_plugin_info) ;
94+ Connection_control_error_handler error_handler;
10095 /* * Notify event coordinator */
10196 g_connection_event_coordinator->notify_event (thd, &error_handler,
10297 connection_event);
@@ -129,11 +124,11 @@ connection_control_init(MYSQL_PLUGIN plugin_info)
129124 return 1 ;
130125
131126 connection_control_plugin_info= plugin_info;
132- Connection_control_error_handler error_handler (connection_control_plugin_info) ;
127+ Connection_control_error_handler error_handler;
133128 g_connection_event_coordinator= new Connection_event_coordinator ();
134129 if (!g_connection_event_coordinator)
135130 {
136- error_handler.handle_error (" Failed to initialize Connection_event_coordinator " );
131+ error_handler.handle_error (ER_CONN_CONTROL_EVENT_COORDINATOR_INIT_FAILED );
137132 deinit_logging_service_for_plugin (®_srv, &log_bi, &log_bs);
138133 return 1 ;
139134 }
@@ -254,7 +249,7 @@ update_failed_connections_threshold(MYSQL_THD thd MY_ATTRIBUTE((unused)),
254249 */
255250 longlong new_value= *(reinterpret_cast <const longlong *>(save));
256251 g_variables.failed_connections_threshold = (int64)new_value;
257- Connection_control_error_handler error_handler (connection_control_plugin_info) ;
252+ Connection_control_error_handler error_handler;
258253 g_connection_event_coordinator->notify_sys_var (&error_handler,
259254 OPT_FAILED_CONNECTIONS_THRESHOLD,
260255 &new_value);
@@ -334,7 +329,7 @@ update_min_connection_delay(MYSQL_THD thd MY_ATTRIBUTE((unused)),
334329{
335330 longlong new_value= *(reinterpret_cast <const longlong *>(save));
336331 g_variables.min_connection_delay = (int64)new_value;
337- Connection_control_error_handler error_handler (connection_control_plugin_info) ;
332+ Connection_control_error_handler error_handler;
338333 g_connection_event_coordinator->notify_sys_var (&error_handler,
339334 OPT_MIN_CONNECTION_DELAY,
340335 &new_value);
@@ -414,7 +409,7 @@ update_max_connection_delay(MYSQL_THD thd MY_ATTRIBUTE((unused)),
414409{
415410 longlong new_value= *(reinterpret_cast <const longlong *>(save));
416411 g_variables.max_connection_delay = (int64)new_value;
417- Connection_control_error_handler error_handler (connection_control_plugin_info) ;
412+ Connection_control_error_handler error_handler;
418413 g_connection_event_coordinator->notify_sys_var (&error_handler,
419414 OPT_MAX_CONNECTION_DELAY,
420415 &new_value);
0 commit comments