Log server name in error message

This makes it clear which server failed.
This commit is contained in:
Markus Mäkelä 2020-10-29 15:33:48 +02:00
parent 11368e5ed0
commit 87f97a16c3
No known key found for this signature in database
GPG Key ID: 5CE746D557ACC499

View File

@ -68,8 +68,8 @@ struct AddressInfo
};
static AddressInfo get_ip_string_and_port(const sockaddr_storage* sa);
static bool gw_connection_established(DCB* dcb);
static bool gw_auth_is_complete(DCB* dcb);
json_t* gw_json_diagnostics(DCB* dcb);
static bool gw_auth_is_complete(DCB* dcb);
json_t* gw_json_diagnostics(DCB* dcb);
extern "C"
{
@ -604,16 +604,20 @@ static std::string get_detailed_error(DCB* dcb)
{
std::ostringstream ss;
ss << " (" << dcb->server->name();
if (int err = gw_getsockerrno(dcb->fd))
{
ss << " (" << err << ", " << mxs_strerror(err) << ")";
ss << ": " << err << ", " << mxs_strerror(err);
}
else if (dcb->is_fake_event)
{
// Fake events should not have TCP socket errors
ss << " (Generated event)";
ss << ": Generated event";
}
ss << ")";
return ss.str();
}