mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 15:15:10 +00:00
[ADD] Try to renegociate an XMPP stream on failure
This commit is contained in:
parent
b78f7b6ab3
commit
40e3242465
1 changed files with 77 additions and 47 deletions
|
|
@ -244,6 +244,8 @@ ParseeXMPPThread(void *argp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (!args->halted)
|
||||||
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
char *id;
|
char *id;
|
||||||
|
|
@ -300,10 +302,38 @@ ParseeXMPPThread(void *argp)
|
||||||
if (!args->halted)
|
if (!args->halted)
|
||||||
{
|
{
|
||||||
Log(LOG_WARNING, "XMPP server is closing stream...");
|
Log(LOG_WARNING, "XMPP server is closing stream...");
|
||||||
Log(LOG_WARNING, "Stopping %s...", NAME);
|
for (size_t i = 0; i < 50; i++)
|
||||||
error = true;
|
{
|
||||||
|
UtilSleepMillis(100); /* Wait a bit so that temporary failures don't fuck everything up */
|
||||||
|
|
||||||
|
Log(LOG_WARNING, "Restarting XMPP stream.");
|
||||||
|
/* This is the part where a new connection is being considered */
|
||||||
|
XMPPFinishCompStream(jabber);
|
||||||
|
XMPPEndCompStream(jabber);
|
||||||
|
|
||||||
|
args->jabber = XMPPInitialiseCompStream(
|
||||||
|
args->config->component_addr,
|
||||||
|
args->config->component_host,
|
||||||
|
args->config->component_port
|
||||||
|
);
|
||||||
|
jabber = args->jabber;
|
||||||
|
if (!jabber || !XMPPAuthenticateCompStream(jabber, args->config->shared_comp_secret))
|
||||||
|
{
|
||||||
|
/* Oops, there is something wrong! */
|
||||||
|
Log(LOG_ERR, "Couldn't authenticate to XMPP server");
|
||||||
|
XMPPEndCompStream(jabber);
|
||||||
|
args->jabber = NULL;
|
||||||
|
jabber = NULL;
|
||||||
|
if (i == 4)
|
||||||
|
{
|
||||||
|
pthread_mutex_unlock(&args->halt_lock);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(&args->halt_lock);
|
pthread_mutex_unlock(&args->halt_lock);
|
||||||
|
}
|
||||||
|
|
||||||
info.running = false;
|
info.running = false;
|
||||||
for (i = 0; i < info.available_dispatchers; i++)
|
for (i = 0; i < info.available_dispatchers; i++)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue