diff --git a/src/gui/qt/startwindow/startwindowimpl.cpp b/src/gui/qt/startwindow/startwindowimpl.cpp index e8565d28..8e1b1331 100644 --- a/src/gui/qt/startwindow/startwindowimpl.cpp +++ b/src/gui/qt/startwindow/startwindowimpl.cpp @@ -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."), diff --git a/src/net/common/clientstate.cpp b/src/net/common/clientstate.cpp index 2f0de9cd..9f7091c6 100644 --- a/src/net/common/clientstate.cpp +++ b/src/net/common/clientstate.cpp @@ -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); + } } } diff --git a/src/net/socket_msg.h b/src/net/socket_msg.h index d65fe604..0dcf9e7b 100644 --- a/src/net/socket_msg.h +++ b/src/net/socket_msg.h @@ -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