[asterisk-commits] file: branch 11 r383266 - /branches/11/res/res_xmpp.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Mar 16 10:14:48 CDT 2013
Author: file
Date: Sat Mar 16 10:14:37 2013
New Revision: 383266
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383266
Log:
Fix a bug where resources were not found due to hashing on the priority itself.
Modified:
branches/11/res/res_xmpp.c
Modified: branches/11/res/res_xmpp.c
URL: http://svnview.digium.com/svn/asterisk/branches/11/res/res_xmpp.c?view=diff&rev=383266&r1=383265&r2=383266
==============================================================================
--- branches/11/res/res_xmpp.c (original)
+++ branches/11/res/res_xmpp.c Sat Mar 16 10:14:37 2013
@@ -700,10 +700,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 */
@@ -1545,7 +1545,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);
}
@@ -1616,7 +1616,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);
}
@@ -2344,7 +2344,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;
}
@@ -3137,7 +3137,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