mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	This is basically a complete rollback of r155401, as it was determined that
it would be best to maintain API compatibility. Instead, this commit introduces ao2_callback_data() which is functionally identical to ao2_callback() except that it allows you to pass arbitrary data to the callback. Reviewed by Mark Michelson via ReviewBoard: http://reviewboard.digium.com/r/64 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@158959 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		| @@ -855,7 +855,7 @@ static int queue_hash_cb(const void *obj, const int flags) | ||||
| 	return ast_str_case_hash(q->name); | ||||
| } | ||||
|  | ||||
| static int queue_cmp_cb(void *obj, void *arg, void *data, int flags) | ||||
| static int queue_cmp_cb(void *obj, void *arg, int flags) | ||||
| { | ||||
| 	struct call_queue *q = obj, *q2 = arg; | ||||
| 	return !strcasecmp(q->name, q2->name) ? CMP_MATCH | CMP_STOP : 0; | ||||
| @@ -1128,7 +1128,7 @@ static int member_hash_fn(const void *obj, const int flags) | ||||
| 	return ret; | ||||
| } | ||||
|  | ||||
| static int member_cmp_fn(void *obj1, void *obj2, void *data, int flags) | ||||
| static int member_cmp_fn(void *obj1, void *obj2, int flags) | ||||
| { | ||||
| 	struct member *mem1 = obj1, *mem2 = obj2; | ||||
| 	return strcasecmp(mem1->interface, mem2->interface) ? 0 : CMP_MATCH | CMP_STOP; | ||||
| @@ -1642,7 +1642,7 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as | ||||
| 	char tmpbuf[64];	/* Must be longer than the longest queue param name. */ | ||||
|  | ||||
| 	/* Static queues override realtime. */ | ||||
| 	if ((q = ao2_find(queues, &tmpq, NULL, OBJ_POINTER))) { | ||||
| 	if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) { | ||||
| 		ao2_lock(q); | ||||
| 		if (!q->realtime) { | ||||
| 			if (q->dead) { | ||||
| @@ -1768,7 +1768,7 @@ static struct call_queue *load_realtime_queue(const char *queuename) | ||||
| 	}; | ||||
|  | ||||
| 	/* Find the queue in the in-core list first. */ | ||||
| 	q = ao2_find(queues, &tmpq, NULL, OBJ_POINTER); | ||||
| 	q = ao2_find(queues, &tmpq, OBJ_POINTER); | ||||
|  | ||||
| 	if (!q || q->realtime) { | ||||
| 		/*! \note Load from realtime before taking the "queues" container lock, to avoid blocking all | ||||
| @@ -2237,7 +2237,7 @@ static int compare_weight(struct call_queue *rq, struct member *member) | ||||
| 		} | ||||
| 		ao2_lock(q); | ||||
| 		if (q->count && q->members) { | ||||
| 			if ((mem = ao2_find(q->members, member, NULL, OBJ_POINTER))) { | ||||
| 			if ((mem = ao2_find(q->members, member, OBJ_POINTER))) { | ||||
| 				ast_debug(1, "Found matching member %s in queue '%s'\n", mem->interface, q->name); | ||||
| 				if (q->weight > rq->weight) { | ||||
| 					ast_debug(1, "Queue '%s' (weight %d, calls %d) is preferred over '%s' (weight %d, calls %d)\n", q->name, q->weight, q->count, rq->name, rq->weight, rq->count); | ||||
| @@ -3126,7 +3126,7 @@ static int update_queue(struct call_queue *q, struct member *member, int callcom | ||||
| 		queue_iter = ao2_iterator_init(queues, 0); | ||||
| 		while ((qtmp = ao2_iterator_next(&queue_iter))) { | ||||
| 			ao2_lock(qtmp); | ||||
| 			if ((mem = ao2_find(qtmp->members, member, NULL, OBJ_POINTER))) { | ||||
| 			if ((mem = ao2_find(qtmp->members, member, OBJ_POINTER))) { | ||||
| 				time(&mem->lastcall); | ||||
| 				mem->calls++; | ||||
| 				mem->lastqueue = q; | ||||
| @@ -4176,10 +4176,10 @@ static int remove_from_queue(const char *queuename, const char *interface) | ||||
| 	int res = RES_NOSUCHQUEUE; | ||||
|  | ||||
| 	ast_copy_string(tmpmem.interface, interface, sizeof(tmpmem.interface)); | ||||
| 	if ((q = ao2_find(queues, &tmpq, NULL, OBJ_POINTER))) { | ||||
| 	if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) { | ||||
| 		ao2_lock(queues); | ||||
| 		ao2_lock(q); | ||||
| 		if ((mem = ao2_find(q->members, &tmpmem, NULL, OBJ_POINTER))) { | ||||
| 		if ((mem = ao2_find(q->members, &tmpmem, OBJ_POINTER))) { | ||||
| 			/* XXX future changes should beware of this assumption!! */ | ||||
| 			if (!mem->dynamic) { | ||||
| 				ao2_ref(mem, -1); | ||||
| @@ -4404,7 +4404,7 @@ static int get_member_penalty(char *queuename, char *interface) | ||||
| 	}; | ||||
| 	struct member *mem; | ||||
| 	 | ||||
| 	if ((q = ao2_find(queues, &tmpq, NULL, OBJ_POINTER))) { | ||||
| 	if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) { | ||||
| 		foundqueue = 1; | ||||
| 		ao2_lock(q); | ||||
| 		if ((mem = interface_exists(q, interface))) { | ||||
| @@ -4456,7 +4456,7 @@ static void reload_queue_members(void) | ||||
| 			struct call_queue tmpq = { | ||||
| 				.name = queue_name, | ||||
| 			}; | ||||
| 			cur_queue = ao2_find(queues, &tmpq, NULL, OBJ_POINTER); | ||||
| 			cur_queue = ao2_find(queues, &tmpq, OBJ_POINTER); | ||||
| 		}	 | ||||
|  | ||||
| 		if (!cur_queue) | ||||
| @@ -5080,7 +5080,7 @@ static int queue_function_var(struct ast_channel *chan, const char *cmd, char *d | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	if ((q = ao2_find(queues, &tmpq, NULL, OBJ_POINTER))) { | ||||
| 	if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) { | ||||
| 		ao2_lock(q); | ||||
| 		if (q->setqueuevar) { | ||||
| 			sl = 0; | ||||
| @@ -5221,7 +5221,7 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, const char | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	if ((q = ao2_find(queues, &tmpq, NULL, OBJ_POINTER))) { | ||||
| 	if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) { | ||||
| 		ao2_lock(q); | ||||
| 		count = q->count; | ||||
| 		ao2_unlock(q); | ||||
| @@ -5257,7 +5257,7 @@ static int queue_function_queuememberlist(struct ast_channel *chan, const char * | ||||
| 		return -1; | ||||
| 	} | ||||
|  | ||||
| 	if ((q = ao2_find(queues, &tmpq, NULL, OBJ_POINTER))) { | ||||
| 	if ((q = ao2_find(queues, &tmpq, OBJ_POINTER))) { | ||||
| 		int buflen = 0, count = 0; | ||||
| 		struct ao2_iterator mem_iter = ao2_iterator_init(q->members, 0); | ||||
|  | ||||
| @@ -5514,7 +5514,7 @@ static int reload_queues(int reload) | ||||
| 			struct call_queue tmpq = { | ||||
| 				.name = cat, | ||||
| 			}; | ||||
| 			if (!(q = ao2_find(queues, &tmpq, NULL, OBJ_POINTER))) { | ||||
| 			if (!(q = ao2_find(queues, &tmpq, OBJ_POINTER))) { | ||||
| 				/* Make one then */ | ||||
| 				if (!(q = alloc_queue(cat))) { | ||||
| 					/* TODO: Handle memory allocation failure */ | ||||
| @@ -5592,7 +5592,7 @@ static int reload_queues(int reload) | ||||
|  | ||||
| 						/* Find the old position in the list */ | ||||
| 						ast_copy_string(tmpmem.interface, interface, sizeof(tmpmem.interface)); | ||||
| 						cur = ao2_find(q->members, &tmpmem, NULL, OBJ_POINTER | OBJ_UNLINK); | ||||
| 						cur = ao2_find(q->members, &tmpmem, OBJ_POINTER | OBJ_UNLINK); | ||||
| 						newm = create_queue_member(interface, membername, penalty, cur ? cur->paused : 0, state_interface); | ||||
| 						ao2_link(q->members, newm); | ||||
| 						ao2_ref(newm, -1); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user