forked from 0ad/0ad
Move XMPP polling to the mainloop. Should reduce lobby disconnects. Fixes #2491
This was SVN commit r15018.
This commit is contained in:
parent
fe490df93a
commit
2ad7187f92
@ -706,13 +706,6 @@ function onTick()
|
||||
handleNetMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
// If the lobby is running, wake it up every 10 seconds so we stay connected.
|
||||
if (Engine.HasXmppClient() && (Date.now() - lastXmppClientPoll) > 10000)
|
||||
{
|
||||
Engine.RecvXmppClient();
|
||||
lastXmppClientPoll = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
// Called when user selects number of players
|
||||
|
@ -446,9 +446,6 @@ function stripColorCodes(input)
|
||||
|
||||
function onTick()
|
||||
{
|
||||
// Wake up XmppClient
|
||||
Engine.RecvXmppClient();
|
||||
|
||||
updateTimers();
|
||||
checkSpamMonitor();
|
||||
|
||||
|
@ -138,9 +138,6 @@ function onTick()
|
||||
// The XmppClient has been created, we are waiting
|
||||
// to be connected or to receive an error.
|
||||
|
||||
//Wake up XmppClient
|
||||
Engine.RecvXmppClient();
|
||||
|
||||
//Receive messages
|
||||
while (true)
|
||||
{
|
||||
|
@ -435,13 +435,6 @@ function onTick()
|
||||
|
||||
// Clear renamed entities list
|
||||
Engine.GuiInterfaceCall("ClearRenamedEntities");
|
||||
|
||||
// If the lobby is running, wake it up every 10 seconds so we stay connected.
|
||||
if (Engine.HasXmppClient() && (Date.now() - lastXmppClientPoll) > 10000)
|
||||
{
|
||||
Engine.RecvXmppClient();
|
||||
lastXmppClientPoll = Date.now();
|
||||
}
|
||||
}
|
||||
|
||||
function checkPlayerState()
|
||||
|
@ -957,7 +957,6 @@ void GuiScriptingInit(ScriptInterface& scriptInterface)
|
||||
scriptInterface.RegisterFunction<void, &JSI_Lobby::StopXmppClient>("StopXmppClient");
|
||||
scriptInterface.RegisterFunction<void, &JSI_Lobby::ConnectXmppClient>("ConnectXmppClient");
|
||||
scriptInterface.RegisterFunction<void, &JSI_Lobby::DisconnectXmppClient>("DisconnectXmppClient");
|
||||
scriptInterface.RegisterFunction<void, &JSI_Lobby::RecvXmppClient>("RecvXmppClient");
|
||||
scriptInterface.RegisterFunction<void, &JSI_Lobby::SendGetGameList>("SendGetGameList");
|
||||
scriptInterface.RegisterFunction<void, &JSI_Lobby::SendGetBoardList>("SendGetBoardList");
|
||||
scriptInterface.RegisterFunction<void, &JSI_Lobby::SendGetRatingList>("SendGetRatingList");
|
||||
|
@ -22,8 +22,6 @@
|
||||
#include "lib/utf8.h"
|
||||
|
||||
// Debug
|
||||
// TODO: Use builtin error/warning/logging functions.
|
||||
#include <iostream>
|
||||
#include "ps/CLogger.h"
|
||||
|
||||
// Gloox
|
||||
|
@ -80,13 +80,6 @@ void JSI_Lobby::DisconnectXmppClient(ScriptInterface::CxPrivate* UNUSED(pCxPriva
|
||||
g_XmppClient->disconnect();
|
||||
}
|
||||
|
||||
void JSI_Lobby::RecvXmppClient(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||
{
|
||||
if (!g_XmppClient)
|
||||
return;
|
||||
g_XmppClient->recv();
|
||||
}
|
||||
|
||||
void JSI_Lobby::SendGetGameList(ScriptInterface::CxPrivate* UNUSED(pCxPrivate))
|
||||
{
|
||||
if (!g_XmppClient)
|
||||
|
@ -34,7 +34,6 @@ namespace JSI_Lobby
|
||||
void StopXmppClient(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
void ConnectXmppClient(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
void DisconnectXmppClient(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
void RecvXmppClient(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
void SendGetGameList(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
void SendGetBoardList(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
void SendGetRatingList(ScriptInterface::CxPrivate* pCxPrivate);
|
||||
|
@ -66,6 +66,7 @@ that of Atlas depending on commandline parameters.
|
||||
#include "network/NetClient.h"
|
||||
#include "network/NetServer.h"
|
||||
#include "network/NetSession.h"
|
||||
#include "lobby/IXmppClient.h"
|
||||
#include "graphics/Camera.h"
|
||||
#include "graphics/GameView.h"
|
||||
#include "graphics/TextureManager.h"
|
||||
@ -348,6 +349,10 @@ static void Frame()
|
||||
if (g_NetClient)
|
||||
g_NetClient->Flush();
|
||||
|
||||
// Keep us connected to any XMPP servers
|
||||
if (g_XmppClient)
|
||||
g_XmppClient->recv();
|
||||
|
||||
g_UserReporter.Update();
|
||||
|
||||
g_Console->Update(realTimeSinceLastFrame);
|
||||
|
Loading…
Reference in New Issue
Block a user