[Asterisk-cvs] asterisk/apps app_queue.c,1.41,1.42

martinp at lists.digium.com martinp at lists.digium.com
Mon Feb 2 18:44:40 CST 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv22548/apps

Modified Files:
	app_queue.c 
Log Message:
Make the go_on be non-global.


Index: app_queue.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_queue.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- app_queue.c	28 Jan 2004 21:32:48 -0000	1.41
+++ app_queue.c	3 Feb 2004 00:53:21 -0000	1.42
@@ -100,10 +100,6 @@
 "Example: RemoveQueueMember(techsupport|SIP/3000)\n"
 "";
 
-/* whether to exit Queue application after the timeout hits */
-static int go_on = 0;
-
-
 /* We define a customer "local user" structure because we
    use it not only for keeping track of what is in use but
    also for keeping track of who we're dialing. */
@@ -694,7 +690,7 @@
 	return 0;
 }
 
-static int try_calling(struct queue_ent *qe, char *options, char *announceoverride, char *url)
+static int try_calling(struct queue_ent *qe, char *options, char *announceoverride, char *url, int *go_on)
 {
 	struct member *cur;
 	struct localuser *outgoing=NULL, *tmp = NULL;
@@ -742,7 +738,7 @@
 			if (strchr(options, 'H'))
 				tmp->allowdisconnect = 1;
 			if (strchr(options, 'n'))
-				go_on = 1;
+				*go_on = 1;
 		}
 		if (url) {
 			ast_log(LOG_DEBUG, "Queue with URL=%s_\n", url);
@@ -1100,7 +1096,11 @@
 	char *options = NULL;
 	char *url = NULL;
 	char *announceoverride = NULL;
-	
+	/* whether to exit Queue application after the timeout hits */
+	int go_on = 0;
+
+
+
 	/* Our queue entry */
 	struct queue_ent qe;
 	
@@ -1158,14 +1158,9 @@
 		}
 		if (!res) {
 			for (;;) {
-				res = try_calling(&qe, options, announceoverride, url);
+				res = try_calling(&qe, options, announceoverride, url, &go_on);
 				if (res)
 					break;
-				/* exit after a timeout if 'n' option enabled */
-				if (go_on) {
-					res = 0;
-					break;
-				}
 				res = wait_a_bit(&qe);
 				if (res < 0) {
 					if (option_verbose > 2) {
@@ -1176,6 +1171,12 @@
 				}
 				if (res && valid_exit(&qe, res))
 					break;
+
+				/* exit after a timeout if 'n' option enabled */
+				if (go_on) {
+					res = 0;
+					break;
+				}
 			}
 		}
 		/* Don't allow return code > 0 */




More information about the svn-commits mailing list