fixed some NETTYPE usage based on the socket state

This commit is contained in:
oy 2011-07-07 01:48:00 +02:00
parent 83d8422c4c
commit e37d536fdf
4 changed files with 7 additions and 6 deletions

View file

@ -693,12 +693,12 @@ void CClient::Connect(const char *pAddress)
ServerInfoRequest();
if(net_host_lookup(m_aServerAddressStr, &m_ServerAddress, NETTYPE_ALL) != 0)
if(net_host_lookup(m_aServerAddressStr, &m_ServerAddress, m_NetClient.NetType()) != 0)
{
char aBufMsg[256];
str_format(aBufMsg, sizeof(aBufMsg), "could not find the address of %s, connecting to localhost", aBuf);
m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "client", aBufMsg);
net_host_lookup("localhost", &m_ServerAddress, NETTYPE_ALL);
net_host_lookup("localhost", &m_ServerAddress, m_NetClient.NetType());
}
m_RconAuthed = 0;
@ -1799,7 +1799,7 @@ void CClient::VersionUpdate()
{
if(m_VersionInfo.m_State == CVersionInfo::STATE_INIT)
{
Engine()->HostLookup(&m_VersionInfo.m_VersionServeraddr, g_Config.m_ClVersionServer, m_BindAddr.type);
Engine()->HostLookup(&m_VersionInfo.m_VersionServeraddr, g_Config.m_ClVersionServer, m_NetClient.NetType());
m_VersionInfo.m_State = CVersionInfo::STATE_START;
}
else if(m_VersionInfo.m_State == CVersionInfo::STATE_START)
@ -1881,7 +1881,7 @@ void CClient::Run()
Input()->Init();
// start refreshing addresses while we load
MasterServer()->RefreshAddresses(m_BindAddr.type);
MasterServer()->RefreshAddresses(m_NetClient.NetType());
// init the editor
m_pEditor->Init();

View file

@ -118,7 +118,6 @@ class CClient : public IClient, public CDemoPlayer::IListner
float m_FrameTimeHigh;
int m_Frames;
NETADDR m_ServerAddress;
NETADDR m_BindAddr;
int m_WindowMustRefocus;
int m_SnapCrcErrors;
bool m_AutoScreenshotRecycle;

View file

@ -1246,7 +1246,7 @@ int CServer::Run()
}
// master server stuff
m_Register.RegisterUpdate(BindAddr.type);
m_Register.RegisterUpdate(m_NetServer.NetType());
PumpNetwork();

View file

@ -285,6 +285,7 @@ public:
// status requests
NETADDR ClientAddr(int ClientID) const { return m_aSlots[ClientID].m_Connection.PeerAddress(); }
NETSOCKET Socket() const { return m_Socket; }
int NetType() { return m_Socket.type; }
int MaxClients() const { return m_MaxClients; }
//
@ -320,6 +321,7 @@ public:
int ResetErrorString();
// error and state
int NetType() { return m_Socket.type; }
int State();
int GotProblems();
const char *ErrorString();