Skip to content

Commit 2d3aad2

Browse files
committed
Merge branch 'mysql-8.0' into mysql-trunk
2 parents 39e11d7 + 13554b3 commit 2d3aad2

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

plugin/x/src/sql_data_context.cc

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,26 +120,18 @@ ngs::Error_code Sql_data_context::init(const bool is_admin) {
120120
}
121121

122122
void Sql_data_context::report_error(int error, ...) {
123-
if (attach()) return;
124-
125123
va_list args;
126124
va_start(args, error);
127125

128126
modules::Module_mysqlx::get_instance_services()->m_runtime_error->emit(
129127
m_authentication_code.error, MYF(0), args);
130128

131129
va_end(args);
132-
detach();
133130
}
134131

135132
void Sql_data_context::deinit() {
136133
if (m_mysql_session) {
137-
srv_session_detach(m_mysql_session);
138-
139-
log_debug("sqlsession deinit: %p [%i]", m_mysql_session,
140-
srv_session_info_get_session_id(m_mysql_session));
141-
142-
if (m_pre_authenticate_event_fired) {
134+
if (m_pre_authenticate_event_fired && !attach()) {
143135
if (!m_authentication_code) {
144136
// In case of successfull login, connect event has been generated
145137
// earlier. Time for generating disconnect event.
@@ -191,6 +183,11 @@ void Sql_data_context::deinit() {
191183
m_pre_authenticate_event_fired = false;
192184
m_authentication_code = ngs::Error_code();
193185

186+
srv_session_detach(m_mysql_session);
187+
188+
log_debug("sqlsession deinit: %p [%i]", m_mysql_session,
189+
srv_session_info_get_session_id(m_mysql_session));
190+
194191
srv_session_close(m_mysql_session);
195192
m_mysql_session = nullptr;
196193
}

0 commit comments

Comments
 (0)