mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Merge pull request #195 from east/ddelay
Fix dummy connect delay (Fullfill securitytoken handshake)
This commit is contained in:
commit
2b8a417941
|
@ -43,6 +43,8 @@ public:
|
|||
|
||||
CNetObj_PlayerInput DummyInput;
|
||||
|
||||
bool m_DummySendConnInfo;
|
||||
|
||||
class CSnapItem
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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; }
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue