Skip to content

Commit

Permalink
bug fix: run auth before setting resp version
Browse files Browse the repository at this point in the history
  • Loading branch information
sewenew committed Jan 1, 2023
1 parent 677d74b commit f3b19a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
22 changes: 11 additions & 11 deletions src/sw/redis++/async_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ void AsyncConnection::connect_callback(std::exception_ptr err) {
_connecting_callback();
break;

case State::SET_RESP:
_set_resp_callback();
break;

case State::AUTHING:
_authing_callback();
break;

case State::SET_RESP:
_set_resp_callback();
break;

case State::SELECTING_DB:
_select_db_callback();
break;
Expand Down Expand Up @@ -316,10 +316,10 @@ void AsyncConnection::_fail_events(std::exception_ptr err) {
}

void AsyncConnection::_connecting_callback() {
if (_need_set_resp()) {
_set_resp();
} else if (_need_auth()) {
if (_need_auth()) {
_auth();
} else if (_need_set_resp()) {
_set_resp();
} else if (_need_select_db()) {
_select_db();
} else if (_need_enable_readonly()) {
Expand All @@ -330,9 +330,7 @@ void AsyncConnection::_connecting_callback() {
}

void AsyncConnection::_set_resp_callback() {
if (_need_auth()) {
_auth();
} else if (_need_select_db()) {
if (_need_select_db()) {
_select_db();
} else if (_need_enable_readonly()) {
_enable_readonly();
Expand All @@ -342,7 +340,9 @@ void AsyncConnection::_set_resp_callback() {
}

void AsyncConnection::_authing_callback() {
if (_need_select_db()) {
if (_need_set_resp()) {
_set_resp();
} else if (_need_select_db()) {
_select_db();
} else if (_need_enable_readonly()) {
_enable_readonly();
Expand Down
4 changes: 2 additions & 2 deletions src/sw/redis++/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,12 @@ void Connection::set_push_callback(redisPushFn *push_func) {
#endif

void Connection::_set_options() {
_auth();

if (_opts.resp > 2) {
_set_resp_version();
}

_auth();

_select_db();

if (_opts.readonly) {
Expand Down

0 comments on commit f3b19a8

Please sign in to comment.