Polish Bolt client and mg_client

Reviewers: mculinovic, teon.banek

Reviewed By: teon.banek

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1681
This commit is contained in:
Matej Ferencevic
2018-10-19 12:28:38 +02:00
parent 078ab75145
commit 0013cbb173
17 changed files with 119 additions and 94 deletions

View File

@@ -32,7 +32,7 @@ bool Client::Connect(const io::network::Endpoint &endpoint) {
// Create a new SSL object that will be used for SSL communication.
ssl_ = SSL_new(context_->context());
if (ssl_ == nullptr) {
LOG(ERROR) << "Couldn't create client SSL object!";
DLOG(ERROR) << "Couldn't create client SSL object!";
socket_.Close();
return false;
}
@@ -43,7 +43,7 @@ bool Client::Connect(const io::network::Endpoint &endpoint) {
// handle that in our socket destructor).
bio_ = BIO_new_socket(socket_.fd(), BIO_NOCLOSE);
if (bio_ == nullptr) {
LOG(ERROR) << "Couldn't create client BIO object!";
DLOG(ERROR) << "Couldn't create client BIO object!";
socket_.Close();
return false;
}
@@ -59,7 +59,7 @@ bool Client::Connect(const io::network::Endpoint &endpoint) {
// Perform the TLS handshake.
auto ret = SSL_connect(ssl_);
if (ret != 1) {
LOG(WARNING) << "Couldn't connect to SSL server: " << SslGetLastError();
DLOG(WARNING) << "Couldn't connect to SSL server: " << SslGetLastError();
socket_.Close();
return false;
}
@@ -70,6 +70,8 @@ bool Client::Connect(const io::network::Endpoint &endpoint) {
bool Client::ErrorStatus() { return socket_.ErrorStatus(); }
bool Client::IsConnected() { return socket_.IsOpen(); }
void Client::Shutdown() { socket_.Shutdown(); }
void Client::Close() {
@@ -111,7 +113,7 @@ bool Client::Read(size_t len) {
continue;
} else {
// This is a fatal error.
LOG(ERROR) << "Received an unexpected SSL error: " << err;
DLOG(ERROR) << "Received an unexpected SSL error: " << err;
return false;
}
} else if (got == 0) {