Adding different error messages for connection failure with IPv6 (#276).

This commit is contained in:
lotodore
2014-05-10 21:06:50 +02:00
parent 316f2f43c3
commit 36149eddfe
3 changed files with 25 additions and 2 deletions
@@ -771,12 +771,24 @@ void startWindowImpl::networkError(int errorID, int /*osErrorID*/)
QMessageBox::Close);
}
break;
case ERR_SOCK_CONNECT_IPV6_FAILED: {
MyMessageBox::warning(this, tr("Network Error"),
tr("Could not connect to the server.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
QMessageBox::Close);
}
break;
case ERR_SOCK_CONNECT_TIMEOUT: {
MyMessageBox::warning(this, tr("Network Error"),
tr("Connection timed out.\nPlease check the server address.\n\nIf the server is behind a NAT-Router, make sure port forwarding has been set up on server side."),
QMessageBox::Close);
}
break;
case ERR_SOCK_CONNECT_IPV6_TIMEOUT: {
MyMessageBox::warning(this, tr("Network Error"),
tr("Connection timed out.\nPlease check the server address.\n\nPlease note: IPv6 is enabled in the settings. The connection fails if your provider does not support IPv6.\nThis may be fixed by unchecking the \"Use IPv6\" checkbox in the settings."),
QMessageBox::Close);
}
break;
case ERR_SOCK_SELECT_FAILED: {
MyMessageBox::warning(this, tr("Network Error"),
tr("Internal network error: \"select\" failed."),
+11 -2
View File
@@ -517,7 +517,11 @@ ClientStateStartConnect::HandleConnect(const boost::system::error_code& ec, boos
client));
} else {
if (ec != boost::asio::error::operation_aborted) {
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_FAILED, ec.value());
if (client->GetContext().GetAddrFamily() == AF_INET6) {
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_IPV6_FAILED, ec.value());
} else {
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_FAILED, ec.value());
}
}
}
}
@@ -529,7 +533,12 @@ ClientStateStartConnect::TimerTimeout(const boost::system::error_code& ec, boost
if (!ec && &client->GetState() == this) {
boost::system::error_code ec;
client->GetContext().GetSessionData()->GetAsioSocket()->close(ec);
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_TIMEOUT, 0);
if (client->GetContext().GetAddrFamily() == AF_INET6) {
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_IPV6_TIMEOUT, 0);
}
else {
throw ClientException(__FILE__, __LINE__, ERR_SOCK_CONNECT_TIMEOUT, 0);
}
}
}
+2
View File
@@ -61,6 +61,8 @@
#define ERR_SOCK_TRANSFER_INVALID_URL 26
#define ERR_SOCK_TRANSFER_SELECT_FAILED 27
#define ERR_SOCK_TRANSFER_FAILED 28
#define ERR_SOCK_CONNECT_IPV6_FAILED 29
#define ERR_SOCK_CONNECT_IPV6_TIMEOUT 30
// The following errors are game errors.
#define ERR_NET_VERSION_NOT_SUPPORTED 101
#define ERR_NET_SERVER_MAINTENANCE 102