Merge pull request #195 from east/ddelay

Fix dummy connect delay (Fullfill securitytoken handshake)
This commit is contained in:
Dennis Felsing 2015-04-20 18:07:26 +02:00
commit 2b8a417941
3 changed files with 32 additions and 20 deletions

View file

@ -43,6 +43,8 @@ public:
CNetObj_PlayerInput DummyInput;
bool m_DummySendConnInfo;
class CSnapItem
{
public:

View file

@ -784,28 +784,10 @@ void CClient::DummyConnect()
m_RconAuthed[1] = 0;
m_DummySendConnInfo = true;
//connecting to the server
m_NetClient[1].Connect(&m_ServerAddress);
// send client info
CMsgPacker MsgInfo(NETMSG_INFO);
MsgInfo.AddString(GameClient()->NetVersion(), 128);
MsgInfo.AddString(g_Config.m_Password, 128);
SendMsgExY(&MsgInfo, MSGFLAG_VITAL|MSGFLAG_FLUSH, true, 1);
// update netclient
m_NetClient[1].Update();
// send ready
CMsgPacker MsgReady(NETMSG_READY);
SendMsgExY(&MsgReady, MSGFLAG_VITAL|MSGFLAG_FLUSH, true, 1);
// startinfo
GameClient()->SendDummyInfo(true);
// send enter game an finish the connection
CMsgPacker MsgEnter(NETMSG_ENTERGAME);
SendMsgExY(&MsgEnter, MSGFLAG_VITAL|MSGFLAG_FLUSH, true, 1);
}
void CClient::DummyDisconnect(const char *pReason)
@ -2657,6 +2639,32 @@ void CClient::Run()
m_aCmdConnect[0] = 0;
}
// progress on dummy connect if token available
if (m_DummySendConnInfo && m_NetClient[1].HasSecurityToken())
{
m_DummySendConnInfo = false;
// send client info
CMsgPacker MsgInfo(NETMSG_INFO);
MsgInfo.AddString(GameClient()->NetVersion(), 128);
MsgInfo.AddString(g_Config.m_Password, 128);
SendMsgExY(&MsgInfo, MSGFLAG_VITAL|MSGFLAG_FLUSH, true, 1);
// update netclient
m_NetClient[1].Update();
// send ready
CMsgPacker MsgReady(NETMSG_READY);
SendMsgExY(&MsgReady, MSGFLAG_VITAL|MSGFLAG_FLUSH, true, 1);
// startinfo
GameClient()->SendDummyInfo(true);
// send enter game an finish the connection
CMsgPacker MsgEnter(NETMSG_ENTERGAME);
SendMsgExY(&MsgEnter, MSGFLAG_VITAL|MSGFLAG_FLUSH, true, 1);
}
// update input
if(Input()->Update())
break; // SDL_QUIT

View file

@ -383,6 +383,8 @@ public:
int State();
int GotProblems();
const char *ErrorString();
bool HasSecurityToken() { return m_Connection.SecurityToken() != NET_SECURITY_TOKEN_UNKNOWN && m_Connection.SecurityToken() != NET_SECURITY_TOKEN_UNSUPPORTED; }
};