mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 17:48:19 +00:00
Merge pull request #8704 from Robyt3/Client-Connect-Resolve-Error
Show warning when connect address cannot be resolved
This commit is contained in:
commit
44666c21f7
|
@ -456,7 +456,6 @@ void CClient::Connect(const char *pAddress, const char *pPassword)
|
||||||
Disconnect();
|
Disconnect();
|
||||||
dbg_assert(m_State == IClient::STATE_OFFLINE, "Disconnect must ensure that client is offline");
|
dbg_assert(m_State == IClient::STATE_OFFLINE, "Disconnect must ensure that client is offline");
|
||||||
|
|
||||||
m_ConnectionId = RandomUuid();
|
|
||||||
if(pAddress != m_aConnectAddressStr)
|
if(pAddress != m_aConnectAddressStr)
|
||||||
str_copy(m_aConnectAddressStr, pAddress);
|
str_copy(m_aConnectAddressStr, pAddress);
|
||||||
|
|
||||||
|
@ -464,8 +463,6 @@ void CClient::Connect(const char *pAddress, const char *pPassword)
|
||||||
str_format(aMsg, sizeof(aMsg), "connecting to '%s'", m_aConnectAddressStr);
|
str_format(aMsg, sizeof(aMsg), "connecting to '%s'", m_aConnectAddressStr);
|
||||||
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "client", aMsg, gs_ClientNetworkPrintColor);
|
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "client", aMsg, gs_ClientNetworkPrintColor);
|
||||||
|
|
||||||
ServerInfoRequest();
|
|
||||||
|
|
||||||
int NumConnectAddrs = 0;
|
int NumConnectAddrs = 0;
|
||||||
NETADDR aConnectAddrs[MAX_SERVER_ADDRESSES];
|
NETADDR aConnectAddrs[MAX_SERVER_ADDRESSES];
|
||||||
mem_zero(aConnectAddrs, sizeof(aConnectAddrs));
|
mem_zero(aConnectAddrs, sizeof(aConnectAddrs));
|
||||||
|
@ -502,11 +499,18 @@ void CClient::Connect(const char *pAddress, const char *pPassword)
|
||||||
|
|
||||||
if(NumConnectAddrs == 0)
|
if(NumConnectAddrs == 0)
|
||||||
{
|
{
|
||||||
log_error("client", "could not find any connect address, defaulting to localhost for whatever reason...");
|
log_error("client", "could not find any connect address");
|
||||||
net_host_lookup("localhost", &aConnectAddrs[0], m_aNetClient[CONN_MAIN].NetType());
|
char aWarning[256];
|
||||||
NumConnectAddrs = 1;
|
str_format(aWarning, sizeof(aWarning), Localize("Could not resolve connect address '%s'. See local console for details."), m_aConnectAddressStr);
|
||||||
|
SWarning Warning(Localize("Connect address error"), aWarning);
|
||||||
|
Warning.m_AutoHide = false;
|
||||||
|
AddWarning(Warning);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_ConnectionId = RandomUuid();
|
||||||
|
ServerInfoRequest();
|
||||||
|
|
||||||
if(m_SendPassword)
|
if(m_SendPassword)
|
||||||
{
|
{
|
||||||
str_copy(m_aPassword, g_Config.m_Password);
|
str_copy(m_aPassword, g_Config.m_Password);
|
||||||
|
|
Loading…
Reference in a new issue