Skip to content

Commit

Permalink
core: rework client::connect() method using easy outs
Browse files Browse the repository at this point in the history
  • Loading branch information
deniskovalchuk committed Apr 14, 2024
1 parent fcf967a commit 7591ddd
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,26 @@ replies client::connect(std::string_view hostname,
replies replies;
reply reply = recv(replies);

if (reply.is_negative())
{
return replies;
}

/* Perform SSL handshake. */
if (ssl_context_ && reply.is_positive())
if (ssl_context_)
{
reply = process_command("AUTH TLS", replies);

if (reply.is_positive())
if (reply.is_negative())
{
control_connection_.set_ssl(ssl_context_.get());
control_connection_.ssl_handshake();
return replies;
}

control_connection_.set_ssl(ssl_context_.get());
control_connection_.ssl_handshake();
}

if (username && reply.is_positive())
if (username)
{
reply = process_login(username.value(), password, replies);
}
Expand Down

0 comments on commit 7591ddd

Please sign in to comment.