[asterisk-commits] file: trunk r383267 - in /trunk: ./ res/res_xmpp.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Mar 16 10:15:46 CDT 2013
Author: file
Date: Sat Mar 16 10:15:44 2013
New Revision: 383267
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383267
Log:
Fix a bug where resources were not found due to hashing on the priority itself.
........
Merged revisions 383266 from http://svn.asterisk.org/svn/asterisk/branches/11
Modified:
trunk/ (props changed)
trunk/res/res_xmpp.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Modified: trunk/res/res_xmpp.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_xmpp.c?view=diff&rev=383267&r1=383266&r2=383267
==============================================================================
--- trunk/res/res_xmpp.c (original)
+++ trunk/res/res_xmpp.c Sat Mar 16 10:15:44 2013
@@ -831,10 +831,10 @@
/*! \brief Comparator function for XMPP resource */
static int xmpp_resource_cmp(void *obj, void *arg, int flags)
{
- struct ast_xmpp_resource *resource1 = obj, *resource2 = arg;
+ struct ast_xmpp_resource *resource1 = obj;
const char *resource = arg;
- return !strcmp(resource1->resource, flags & OBJ_KEY ? resource : resource2->resource) ? CMP_MATCH | CMP_STOP : 0;
+ return !strcmp(resource1->resource, resource) ? CMP_MATCH | CMP_STOP : 0;
}
/*! \brief Destructor callback function for XMPP buddy */
@@ -1681,7 +1681,7 @@
return -1;
}
- if (ast_strlen_zero(jid.resource) || !(resource = ao2_find(buddy->resources, jid.resource, OBJ_KEY))) {
+ if (ast_strlen_zero(jid.resource) || !(resource = ao2_callback(buddy->resources, 0, xmpp_resource_cmp, jid.resource))) {
resource = ao2_callback(buddy->resources, OBJ_NODATA, xmpp_resource_immediate, NULL);
}
@@ -1752,7 +1752,7 @@
return -1;
}
- if (ast_strlen_zero(jid.resource) || !(resource = ao2_find(buddy->resources, jid.resource, OBJ_KEY))) {
+ if (ast_strlen_zero(jid.resource) || !(resource = ao2_callback(buddy->resources, 0, xmpp_resource_cmp, jid.resource))) {
resource = ao2_callback(buddy->resources, OBJ_NODATA, xmpp_resource_immediate, NULL);
}
@@ -2480,7 +2480,7 @@
return IKS_FILTER_EAT;
}
- if (!(resource = ao2_find(buddy->resources, pak->from->resource, OBJ_KEY))) {
+ if (!(resource = ao2_callback(buddy->resources, 0, xmpp_resource_cmp, pak->from->resource))) {
ao2_ref(buddy, -1);
return IKS_FILTER_EAT;
}
@@ -3273,7 +3273,7 @@
ao2_lock(buddy->resources);
- if (!(resource = ao2_find(buddy->resources, pak->from->resource, OBJ_KEY | OBJ_NOLOCK))) {
+ if (!(resource = ao2_callback(buddy->resources, OBJ_NOLOCK, xmpp_resource_cmp, pak->from->resource))) {
/* Only create the new resource if it is not going away - in reality this should not happen */
if (status != STATUS_DISAPPEAR) {
if (!(resource = ao2_alloc(sizeof(*resource), xmpp_resource_destructor))) {
More information about the asterisk-commits
mailing list