mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 23:05:10 +00:00
[WIP/FIX] Lock write operations to XMPP
I *think* that fixes stream errors with two threads writing at once. Even if it doesn't, I think it's always a nice-to-have.
This commit is contained in:
parent
42d69226f0
commit
37155316b2
4 changed files with 32 additions and 0 deletions
|
|
@ -17,6 +17,9 @@ XMPPQueryMUC(XMPPComponent *jabber, char *muc, MUCInfo *out)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&jabber->write_lock);
|
||||
|
||||
iq_query = XMLCreateTag("iq");
|
||||
query = XMLCreateTag("query");
|
||||
|
||||
|
|
@ -47,6 +50,7 @@ XMPPQueryMUC(XMPPComponent *jabber, char *muc, MUCInfo *out)
|
|||
{
|
||||
XMLFreeElement(iq_query);
|
||||
ParseeWakeupThread();
|
||||
pthread_mutex_unlock(&jabber->write_lock);
|
||||
return false;
|
||||
}
|
||||
query = XMLookForUnique(iq_query, "query");
|
||||
|
|
@ -58,6 +62,7 @@ XMPPQueryMUC(XMPPComponent *jabber, char *muc, MUCInfo *out)
|
|||
{
|
||||
XMLFreeElement(iq_query);
|
||||
ParseeWakeupThread();
|
||||
pthread_mutex_unlock(&jabber->write_lock);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -74,6 +79,7 @@ XMPPQueryMUC(XMPPComponent *jabber, char *muc, MUCInfo *out)
|
|||
}
|
||||
}
|
||||
/* Wake it up once we're done */
|
||||
pthread_mutex_unlock(&jabber->write_lock);
|
||||
ParseeWakeupThread();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue