mail kit: Improve debugging of internal mail kit network code
* Return the correct error code if there is a connection error * Be more verbose if there is a problem network connection problem instead of showing "Login error: " * IMAP inbound: Show a valid error message if there is a * Show server name resolution, fishes out IPv6 bug #8293
This commit is contained in:
@@ -345,8 +345,15 @@ IMAPInboundProtocol::Connect(const char* server, const char* username,
|
|||||||
status_t status = fIMAPMailbox.Connect(server, username, password, useSSL,
|
status_t status = fIMAPMailbox.Connect(server, username, password, useSSL,
|
||||||
port);
|
port);
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
|
if (fIMAPMailbox.CommandError().CountChars() > 0) {
|
||||||
|
// This was a IMAP error
|
||||||
statusMessage = "Failed to login: ";
|
statusMessage = "Failed to login: ";
|
||||||
statusMessage += fIMAPMailbox.CommandError();
|
statusMessage += fIMAPMailbox.CommandError();
|
||||||
|
} else {
|
||||||
|
// Probably a connection error
|
||||||
|
statusMessage = "Connection error: ";
|
||||||
|
statusMessage += strerror(status);
|
||||||
|
}
|
||||||
ShowError(statusMessage);
|
ShowError(statusMessage);
|
||||||
ResetProgress();
|
ResetProgress();
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
@@ -224,14 +224,19 @@ SocketConnection::Connect(const char* server, uint32 port)
|
|||||||
if (status != B_OK)
|
if (status != B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
TRACE("Server resolves to %s\n", address.ToString().String());
|
||||||
|
|
||||||
fSocket = socket(address.Family(), SOCK_STREAM, 0);
|
fSocket = socket(address.Family(), SOCK_STREAM, 0);
|
||||||
if (fSocket < 0)
|
if (fSocket < 0) {
|
||||||
|
TRACE("%s: Socket Error: %s\n", __func__, strerror(status));
|
||||||
return errno;
|
return errno;
|
||||||
|
}
|
||||||
|
|
||||||
int result = connect(fSocket, address, address.Length());
|
int result = connect(fSocket, address, address.Length());
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
|
TRACE("%s: Connect Error: %s\n", __func__, strerror(result));
|
||||||
close(fSocket);
|
close(fSocket);
|
||||||
return errno;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("SocketConnection: connected\n");
|
TRACE("SocketConnection: connected\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user