[asterisk-commits] mmichelson: branch mmichelson/queue_refcount_trunk r82363 - in /team/mmichels...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 13 18:44:06 CDT 2007


Author: mmichelson
Date: Thu Sep 13 18:44:05 2007
New Revision: 82363

URL: http://svn.digium.com/view/asterisk?view=rev&rev=82363
Log:
Maintenance


Modified:
    team/mmichelson/queue_refcount_trunk/   (props changed)
    team/mmichelson/queue_refcount_trunk/CHANGES
    team/mmichelson/queue_refcount_trunk/apps/app_queue.c
    team/mmichelson/queue_refcount_trunk/channels/chan_sip.c
    team/mmichelson/queue_refcount_trunk/channels/chan_zap.c
    team/mmichelson/queue_refcount_trunk/codecs/gsm/src/long_term.c
    team/mmichelson/queue_refcount_trunk/codecs/gsm/src/lpc.c
    team/mmichelson/queue_refcount_trunk/configs/sip.conf.sample
    team/mmichelson/queue_refcount_trunk/main/app.c
    team/mmichelson/queue_refcount_trunk/main/asterisk.c
    team/mmichelson/queue_refcount_trunk/main/cdr.c
    team/mmichelson/queue_refcount_trunk/main/config.c
    team/mmichelson/queue_refcount_trunk/main/pbx.c
    team/mmichelson/queue_refcount_trunk/res/res_agi.c
    team/mmichelson/queue_refcount_trunk/utils/Makefile
    team/mmichelson/queue_refcount_trunk/utils/hashtest2.c

Propchange: team/mmichelson/queue_refcount_trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.

Propchange: team/mmichelson/queue_refcount_trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/mmichelson/queue_refcount_trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Sep 13 18:44:05 2007
@@ -1,1 +1,1 @@
-/trunk:1-82255
+/trunk:1-82284

Modified: team/mmichelson/queue_refcount_trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/CHANGES?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/CHANGES (original)
+++ team/mmichelson/queue_refcount_trunk/CHANGES Thu Sep 13 18:44:05 2007
@@ -81,7 +81,10 @@
   * Added rtpdest option to CHANNEL() dialplan function.
   * Added SIPREFERRINGCONTEXT and SIPREFERREDBYHDR variables which are set when a transfer takes place.
   * SIP now adds a header to the CANCEL if the call was answered by another phone
-    in the same dial command, or if the new c option in dial() is used.
+     in the same dial command, or if the new c option in dial() is used.
+  * The new default is that 100 Trying is not sent on REGISTER attempts as the RFC specifically
+     states it is not needed. For phones, however, that do require it the registertrying option
+     has been added so it can be enabled. 
 
 IAX2 changes
 ------------

Modified: team/mmichelson/queue_refcount_trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/apps/app_queue.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/apps/app_queue.c (original)
+++ team/mmichelson/queue_refcount_trunk/apps/app_queue.c Thu Sep 13 18:44:05 2007
@@ -869,22 +869,22 @@
 static int interface_exists_global(const char *interface)
 {
 	struct call_queue *q;
-	struct member *mem;
+	struct member *mem, tmpmem;
 	struct ao2_iterator queue_iter;
 	int ret = 0;
 
+	ast_copy_string(tmpmem.interface, interface, sizeof(tmpmem.interface));
 	queue_iter = ao2_iterator_init(queues, 0);
 	while ((q = ao2_iterator_next(&queue_iter))) {
+
 		ast_mutex_lock(&q->lock);
-		if ((mem = ao2_find(q->members, (char *)interface, 0))) {
+		if ((mem = ao2_find(q->members, &tmpmem, OBJ_POINTER))) {
 			ao2_ref(mem, -1);
-			ret = 1;
-		}
-		ast_mutex_unlock(&q->lock);
-		if (ret) {
+			ast_mutex_unlock(&q->lock);
 			queue_unref(q);
 			break;
 		}
+		ast_mutex_unlock(&q->lock);
 		queue_unref(q);
 	}
 
@@ -1097,7 +1097,7 @@
 
 static void rt_handle_member_record(struct call_queue *q, char *interface, const char *membername, const char *penalty_str, const char *paused_str)
 {
-	struct member *m;
+	struct member *m, tmpmem;
 	int penalty = 0;
 	int paused  = 0;
 
@@ -1114,7 +1114,8 @@
 	}
 
 	/* Find the member, or the place to put a new one. */
-	m = ao2_find(q->members, interface, 0);
+	ast_copy_string(tmpmem.interface, interface, sizeof(tmpmem.interface));
+	m = ao2_find(q->members, &tmpmem, OBJ_POINTER);
 
 	/* Create a new one if not found, else update penalty */
 	if (!m) {
@@ -1199,6 +1200,7 @@
 				return q;
 			}
 		}
+		queue_unref(q);
 	} else if (!member_config)
 		/* Not found in the list, and it's not realtime ... */
 		return NULL;
@@ -1228,10 +1230,10 @@
 		ast_mutex_lock(&q->lock);
 		clear_queue(q);
 		q->realtime = 1;
+		init_queue(q);		/* Ensure defaults for all parameters not set explicitly. */
 		ao2_link(queues, q);
 		queue_ref(q);
 	}
-	init_queue(q);		/* Ensure defaults for all parameters not set explicitly. */
 
 	memset(tmpbuf, 0, sizeof(tmpbuf));
 	for (v = queue_vars; v; v = v->next) {
@@ -1665,6 +1667,12 @@
 	}
 	ast_mutex_unlock(&q->lock);
 
+	/*If the queue is a realtime queue, check to see if it's still defined in real time*/
+	if(q->realtime) {
+		if(!ast_load_realtime("queues", "name", q->name, NULL))
+			q->dead = 1;
+	}
+
 	if (q->dead) {	
 		/* It's dead and nobody is in it, so kill it */
 		ao2_unlink(queues, q);
@@ -1684,6 +1692,8 @@
 			ast_hangup(outgoing->chan);
 		oo = outgoing;
 		outgoing = outgoing->q_next;
+		if (oo->member)
+			ao2_ref(oo->member, -1);
 		ast_free(oo);
 	}
 }
@@ -1756,7 +1766,7 @@
 		}
 		ast_mutex_lock(&q->lock);
 		if (q->count && q->members) {
-			if ((mem = ao2_find(q->members, member->interface, 0))) {
+			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);
@@ -3144,12 +3154,14 @@
 static int remove_from_queue(const char *queuename, const char *interface)
 {
 	struct call_queue *q, tmpq;
-	struct member *mem;
+	struct member *mem, tmpmem;
 	int res = RES_NOSUCHQUEUE;
 
+	ast_copy_string(tmpmem.interface, interface, sizeof(tmpmem.interface));
 	ast_copy_string(tmpq.name, queuename, sizeof(tmpq.name));
 	if((q = ao2_find(queues, &tmpq, OBJ_POINTER))) {
-		if ((mem = ao2_find(q->members, (char *)interface, OBJ_UNLINK))) {
+		ast_mutex_lock(&q->lock);
+		if ((mem = ao2_find(q->members, &tmpmem, OBJ_POINTER | OBJ_UNLINK))) {
 			q->membercount--;
 			manager_event(EVENT_FLAG_AGENT, "QueueMemberRemoved",
 				"Queue: %s\r\n"
@@ -3324,8 +3336,10 @@
 			continue;
 		} 
 
-		if (ast_db_get(pm_family, queue_name, queue_data, PM_MAX_LEN))
+		if (ast_db_get(pm_family, queue_name, queue_data, PM_MAX_LEN)) {
+			queue_unref(cur_queue);
 			continue;
+		}
 
 		cur_ptr = queue_data;
 		while ((member = strsep(&cur_ptr, ",|"))) {
@@ -4123,6 +4137,8 @@
 				}
 				for (var = ast_variable_browse(cfg, cat); var; var = var->next) {
 					if (!strcasecmp(var->name, "member")) {
+						struct member tmpmem;
+
 						/* Add a new member */
 						ast_copy_string(parse, var->value, sizeof(parse));
 						
@@ -4146,7 +4162,8 @@
 							membername = interface;
 
 						/* Find the old position in the list */
-						cur = ao2_find(q->members, interface, OBJ_UNLINK);
+						ast_copy_string(tmpmem.interface, interface, sizeof(tmpmem.interface));
+						cur = ao2_find(q->members, &tmpmem, OBJ_POINTER | OBJ_UNLINK);
 
 						newm = create_queue_member(interface, membername, penalty, cur ? cur->paused : 0);
 						ao2_link(q->members, newm);
@@ -4329,9 +4346,11 @@
 	queue_iter = ao2_iterator_init(queues, 0);
 	while((q = ao2_iterator_next(&queue_iter))) {
 		if (!strncasecmp(word, q->name, wordlen) && ++which > state) {
-			ret = ast_strdup(q->name);	
+			ret = ast_strdup(q->name);
+			queue_unref(q);
 			break;
 		}
+		queue_unref(q);
 	}
 
 	return ret;
@@ -4787,6 +4806,7 @@
 				ast_mutex_unlock(&q->lock);
 				tmp = ast_strdup(m->interface);
 				ao2_ref(m, -1);
+				queue_unref(q);
 				return tmp;
 			}
 			ao2_ref(m, -1);

Modified: team/mmichelson/queue_refcount_trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/channels/chan_sip.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/channels/chan_sip.c (original)
+++ team/mmichelson/queue_refcount_trunk/channels/chan_sip.c Thu Sep 13 18:44:05 2007
@@ -855,6 +855,7 @@
 #define SIP_PAGE2_RFC2833_COMPENSATE    (1 << 25)	/*!< DP: Compensate for buggy RFC2833 implementations */
 #define SIP_PAGE2_BUGGY_MWI		(1 << 26)	/*!< DP: Buggy CISCO MWI fix */
 #define SIP_PAGE2_TEXTSUPPORT		(1 << 28)	/*!< GDP: Global text enable */
+#define SIP_PAGE2_REGISTERTRYING        (1 << 29)       /*!< DP: Send 100 Trying on REGISTER attempts */
 
 #define SIP_PAGE2_FLAGS_TO_COPY \
 	(SIP_PAGE2_ALLOWSUBSCRIBE | SIP_PAGE2_ALLOWOVERLAP | SIP_PAGE2_VIDEOSUPPORT | \
@@ -9280,7 +9281,8 @@
 			res = AUTH_PEER_NOT_DYNAMIC;
 		} else {
 			ast_copy_flags(&p->flags[0], &peer->flags[0], SIP_NAT);
-			transmit_response(p, "100 Trying", req);
+			if (ast_test_flag(&p->flags[1], SIP_PAGE2_REGISTERTRYING))
+				transmit_response(p, "100 Trying", req);
 			if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri, XMIT_UNRELIABLE, req->ignore))) {
 				sip_cancel_destroy(p);
 
@@ -11277,6 +11279,7 @@
 		ast_cli(fd, ")\n");
 
 		ast_cli(fd, "  Auto-Framing:  %s \n", cli_yesno(peer->autoframing));
+		ast_cli(fd, "  100 on REG   : %s\n", ast_test_flag(&peer->flags[1], SIP_PAGE2_REGISTERTRYING) ? "Yes" : "No");
 		ast_cli(fd, "  Status       : ");
 		peer_status(peer, status, sizeof(status));
 		ast_cli(fd, "%s\n",status);
@@ -17562,6 +17565,8 @@
 			int error =  ast_parse_allow_disallow(&peer->prefs, &peer->capability, v->value, FALSE);
 			if (error)
 				ast_log(LOG_WARNING, "Codec configuration errors found in line %d : %s = %s\n", v->lineno, v->name, v->value);
+		} else if (!strcasecmp(v->name, "registertrying")) {
+			ast_set2_flag(&peer->flags[1], ast_true(v->value), SIP_PAGE2_REGISTERTRYING);
 		} else if (!strcasecmp(v->name, "autoframing")) {
 			peer->autoframing = ast_true(v->value);
 		} else if (!strcasecmp(v->name, "rtptimeout")) {

Modified: team/mmichelson/queue_refcount_trunk/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/channels/chan_zap.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/channels/chan_zap.c (original)
+++ team/mmichelson/queue_refcount_trunk/channels/chan_zap.c Thu Sep 13 18:44:05 2007
@@ -8903,7 +8903,10 @@
 				} else {
 					p = linkset->pvts[chanpos];
 					ast_mutex_lock(&p->lock);
-					p->ss7call = NULL;
+					if (p->alreadyhungup)
+						p->ss7call = NULL;
+					else
+						ast_log(LOG_NOTICE, "Received RLC out and we haven't sent REL.  Ignoring.\n");
 					ast_mutex_unlock(&p->lock);
 				}
 				break;

Modified: team/mmichelson/queue_refcount_trunk/codecs/gsm/src/long_term.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/codecs/gsm/src/long_term.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/codecs/gsm/src/long_term.c (original)
+++ team/mmichelson/queue_refcount_trunk/codecs/gsm/src/long_term.c Thu Sep 13 18:44:05 2007
@@ -162,7 +162,10 @@
 	word		* Nc_out	/* 		OUT	*/
 )
 {
-	register int  	k, lambda;
+	register int  	k;
+#ifndef K6OPT
+	register int lambda;
+#endif
 	word		Nc, bc;
 	word		wt[40];
 

Modified: team/mmichelson/queue_refcount_trunk/codecs/gsm/src/lpc.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/codecs/gsm/src/lpc.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/codecs/gsm/src/lpc.c (original)
+++ team/mmichelson/queue_refcount_trunk/codecs/gsm/src/lpc.c Thu Sep 13 18:44:05 2007
@@ -35,9 +35,12 @@
  *  be scaled in order to avoid an overflow situation.
  */
 {
+#ifndef K6OPT
 	register int	k, i;
-
-	word		temp, smax, scalauto;
+	word temp;
+#endif
+
+	word		smax, scalauto;
 
 #ifdef	USE_FLOAT_MUL
 	float		float_s[160];

Modified: team/mmichelson/queue_refcount_trunk/configs/sip.conf.sample
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/configs/sip.conf.sample?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/configs/sip.conf.sample (original)
+++ team/mmichelson/queue_refcount_trunk/configs/sip.conf.sample Thu Sep 13 18:44:05 2007
@@ -579,6 +579,7 @@
 ;                             outboundproxy
 ;                             rfc2833compensate
 ;                             callbackextension
+;                             registertrying
 
 ;[sip_proxy]
 ; For incoming calls only. Example: FWD (Free World Dialup)
@@ -703,7 +704,6 @@
 ;callingpres=allowed_passed_screen	; Set caller ID presentation
 				; See README.callingpres for more information
 
-
 ;[xlite1]
 ; Turn off silence suppression in X-Lite ("Transmit Silence"=YES)!
 ; Note that Xlite sends NAT keep-alive packets, so qualify=yes is not needed
@@ -718,7 +718,7 @@
 ;allow=ulaw
 ;allow=alaw
 ;mailbox=1234 at default,1233 at default	; Subscribe to status of multiple mailboxes
-
+;registertrying=yes             ; Send a 100 Trying when the device registers.
 
 ;[snom]
 ;type=friend			; Friends place calls and receive calls

Modified: team/mmichelson/queue_refcount_trunk/main/app.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/main/app.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/main/app.c (original)
+++ team/mmichelson/queue_refcount_trunk/main/app.c Thu Sep 13 18:44:05 2007
@@ -39,6 +39,7 @@
 #include <sys/stat.h>
 #include <sys/file.h>
 #include <regex.h>
+#include <fcntl.h>
 
 #include "asterisk/channel.h"
 #include "asterisk/pbx.h"
@@ -1146,8 +1147,14 @@
 	pl->path = strdup(path);
 
 	time(&start);
-	while (((res = flock(pl->fd, LOCK_EX | LOCK_NB)) < 0) &&
-			(errno == EWOULDBLOCK) && (time(NULL) - start < 5))
+	while ((
+		#ifdef SOLARIS
+		(res = fcntl(pl->fd, F_SETLK, fcntl(pl->fd,F_GETFL)|O_NONBLOCK)) < 0) &&
+		#else
+		(res = flock(pl->fd, LOCK_EX | LOCK_NB)) < 0) &&
+		#endif
+			(errno == EWOULDBLOCK) && 
+			(time(NULL) - start < 5))
 		usleep(1000);
 	if (res) {
 		ast_log(LOG_WARNING, "Failed to lock path '%s': %s\n",

Modified: team/mmichelson/queue_refcount_trunk/main/asterisk.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/main/asterisk.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/main/asterisk.c (original)
+++ team/mmichelson/queue_refcount_trunk/main/asterisk.c Thu Sep 13 18:44:05 2007
@@ -95,6 +95,7 @@
 #include <netdb.h>
 #if defined(SOLARIS)
 int daemon(int, int);  /* defined in libresolv of all places */
+#include <sys/loadavg.h>
 #endif
 #endif
 
@@ -2277,14 +2278,16 @@
 	printf("   -I              Enable internal timing if Zaptel timer is available\n");
 	printf("   -L <load>       Limit the maximum load average before rejecting new calls\n");
 	printf("   -M <value>      Limit the maximum number of calls to the specified value\n");
-	printf("   -m              Mute the console from debugging and verbose output\n");
+	printf("   -m              Mute debugging and console output on the console\n");
 	printf("   -n              Disable console colorization\n");
 	printf("   -p              Run as pseudo-realtime thread\n");
 	printf("   -q              Quiet mode (suppress output)\n");
 	printf("   -r              Connect to Asterisk on this machine\n");
-	printf("   -R              Connect to Asterisk, and attempt to reconnect if disconnected\n");
-	printf("   -t              Record soundfiles in /var/tmp and move them where they belong after they are done.\n");
-	printf("   -T              Display the time in [Mmm dd hh:mm:ss] format for each line of output to the CLI.\n");
+	printf("   -R              Same as -r, except attempt to reconnect if disconnected\n");
+	printf("   -t              Record soundfiles in /var/tmp and move them where they\n");
+	printf("                   belong after they are done\n");
+	printf("   -T              Display the time in [Mmm dd hh:mm:ss] format for each line\n");
+	printf("                   of output to the CLI\n");
 	printf("   -v              Increase verbosity (multiple v's = more verbose)\n");
 	printf("   -x <cmd>        Execute command <cmd> (only valid with -r)\n");
 	printf("\n");

Modified: team/mmichelson/queue_refcount_trunk/main/cdr.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/main/cdr.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/main/cdr.c (original)
+++ team/mmichelson/queue_refcount_trunk/main/cdr.c Thu Sep 13 18:44:05 2007
@@ -977,6 +977,8 @@
 	struct ast_cdr_beitem *i;
 
 	for ( ; cdr ; cdr = cdr->next) {
+		if (cdr->disposition < AST_CDR_ANSWERED && (ast_strlen_zero(cdr->channel) || ast_strlen_zero(cdr->dstchannel)))
+			continue; /* people don't want to see unanswered single-channel events */
 		chan = S_OR(cdr->channel, "<unknown>");
 		check_post(cdr);
 		if (ast_tvzero(cdr->end))

Modified: team/mmichelson/queue_refcount_trunk/main/config.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/main/config.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/main/config.c (original)
+++ team/mmichelson/queue_refcount_trunk/main/config.c Thu Sep 13 18:44:05 2007
@@ -1159,6 +1159,12 @@
 					process_buf = NULL;
 				else
 					process_buf = buf;
+				
+				if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS) && comment_buffer && comment_buffer[0] && (ast_strlen_zero(buf) || strlen(buf) == strspn(buf," \t\n\r"))) {
+					/* blank line? really? Can we add it to an existing comment and maybe preserve inter- and post- comment spacing? */
+					CB_ADD(&comment_buffer, &comment_buffer_size, "\n");       /* add a newline to the comment buffer */
+					continue; /* go get a new line, then */
+				}
 				
 				while ((comment_p = strchr(new_buf, COMMENT_META))) {
 					if ((comment_p > new_buf) && (*(comment_p-1) == '\\')) {
@@ -1228,10 +1234,14 @@
 		/* end of file-- anything in a comment buffer? */
 		if (last_cat) {
 			if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS) && comment_buffer && comment_buffer[0] ) {
+				CB_ADD(&comment_buffer, &comment_buffer_size, lline_buffer);       /* add the current lline buffer to the comment buffer */
+				lline_buffer[0] = 0;        /* erase the lline buffer */
 				last_cat->trailing = ALLOC_COMMENT(comment_buffer);
 			}
 		} else if (last_var) {
 			if (ast_test_flag(&flags, CONFIG_FLAG_WITHCOMMENTS) && comment_buffer && comment_buffer[0] ) {
+				CB_ADD(&comment_buffer, &comment_buffer_size, lline_buffer);       /* add the current lline buffer to the comment buffer */
+				lline_buffer[0] = 0;        /* erase the lline buffer */
 				last_var->trailing = ALLOC_COMMENT(comment_buffer);
 			}
 		} else {

Modified: team/mmichelson/queue_refcount_trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/main/pbx.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/main/pbx.c (original)
+++ team/mmichelson/queue_refcount_trunk/main/pbx.c Thu Sep 13 18:44:05 2007
@@ -39,6 +39,9 @@
 #include <limits.h>
 #if defined(HAVE_SYSINFO)
 #include <sys/sysinfo.h>
+#endif
+#if defined(SOLARIS)
+#include <sys/loadavg.h>
 #endif
 
 #include "asterisk/lock.h"

Modified: team/mmichelson/queue_refcount_trunk/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/res/res_agi.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/res/res_agi.c (original)
+++ team/mmichelson/queue_refcount_trunk/res/res_agi.c Thu Sep 13 18:44:05 2007
@@ -1905,25 +1905,10 @@
 				ast_frfree(f);
 			}
 		} else if (outfd > -1) {
-			size_t len = sizeof(buf);
-			size_t buflen = 0;
-
 			retry = AGI_NANDFS_RETRY;
 			buf[0] = '\0';
 
-			while (buflen < (len - 1)) {
-				fgets(buf + buflen, len, readf);
-				if (feof(readf)) 
-					break;
-				if (ferror(readf) && ((errno != EINTR) && (errno != EAGAIN))) 
-					break;
-				buflen = strlen(buf);
-				len -= buflen;
-				if (agidebug)
-					ast_verbose( "AGI Rx << temp buffer %s - errno %s\n", buf, strerror(errno));
-			}
-
-			if (!buf[0]) {
+			if (!fgets(buf, sizeof(buf), readf)) {
 				/* Program terminated */
 				if (returnstatus && returnstatus != AST_PBX_KEEPALIVE)
 					returnstatus = -1;

Modified: team/mmichelson/queue_refcount_trunk/utils/Makefile
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/utils/Makefile?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/utils/Makefile (original)
+++ team/mmichelson/queue_refcount_trunk/utils/Makefile Thu Sep 13 18:44:05 2007
@@ -129,10 +129,10 @@
 astobj2.o : astobj2.c
 
 hashtest2.o : hashtest2.c
-	$(CC) -g -O0 -c hashtest2.c -I/usr/include -I../include
+	$(CC) -g -O0 -c hashtest2.c $(PTHREAD_CFLAGS) -I/usr/include -I../include
 
 hashtest2 : hashtest2.o md5.o utils.o astobj2.o sha1.o strcompat.o
-	$(CC) -g -O0 -o hashtest2 hashtest2.o astobj2.o utils.o md5.o sha1.o strcompat.o -lpthread
+	$(CC) -g -O0 -o hashtest2 hashtest2.o astobj2.o utils.o md5.o sha1.o strcompat.o $(PTHREAD_CFLAGS) $(PTHREAD_LIBS) $(LIBS)
 
 extconf.o : extconf.c
 

Modified: team/mmichelson/queue_refcount_trunk/utils/hashtest2.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/utils/hashtest2.c?view=diff&rev=82363&r1=82362&r2=82363
==============================================================================
--- team/mmichelson/queue_refcount_trunk/utils/hashtest2.c (original)
+++ team/mmichelson/queue_refcount_trunk/utils/hashtest2.c Thu Sep 13 18:44:05 2007
@@ -148,16 +148,17 @@
 	els_added++; /* unprotected, sometimes off, but, not really important, either */
 }
 
+static int do_nothing_cb(void *obj, void *arg, int flags)
+{
+	return 0;
+}
+
 static void traverse_elements(void)
 {
-	struct ht_element *el;
-	struct ao2_iterator it = ao2_iterator_init(glob_hashtab, 0);
 #ifdef DEBUG
 	printf("Traverse hashtab\n");
 #endif
-	while ((el = ao2_iterator_next(&it))) {
-		ao2_ref(el,-1);
-	}
+	ao2_callback(glob_hashtab, OBJ_NODATA, do_nothing_cb, NULL);
 	els_traversals++; /* unprotected, sometimes off, but, not really important, either */
 }
 




More information about the asterisk-commits mailing list