Simplify should_open in SessionProxy.

GitOrigin-RevId: 5bfa92ed175468d5a247780b73d643735427637c
This commit is contained in:
levlam 2018-11-04 13:53:57 +03:00
parent 0d5a09e615
commit b1d563719a

View File

@ -162,13 +162,10 @@ void SessionProxy::open_session(bool force) {
if (force) {
return true;
}
if (auth_state_ != AuthState::Empty && need_destroy_) {
return true;
}
if (need_destroy_) {
return false;
return auth_state_ != AuthState::Empty;
}
if (is_main_ && !need_destroy_) { // alays open main
if (is_main_) { // always open main for ordinary queries
return true;
}
if (!pending_queries_.empty() && auth_state_ == AuthState::OK) {