[asterisk-commits] jdixon: branch jdixon/chan_usbradio-1.4 r140391 - /team/jdixon/chan_usbradio-...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 27 19:58:28 CDT 2008


Author: jdixon
Date: Wed Aug 27 19:58:27 2008
New Revision: 140391

URL: http://svn.digium.com/view/asterisk?view=rev&rev=140391
Log:
Make chan_echolink work under limey linux

Modified:
    team/jdixon/chan_usbradio-1.4/dev-1.0/channels/chan_echolink.c

Modified: team/jdixon/chan_usbradio-1.4/dev-1.0/channels/chan_echolink.c
URL: http://svn.digium.com/view/asterisk/team/jdixon/chan_usbradio-1.4/dev-1.0/channels/chan_echolink.c?view=diff&rev=140391&r1=140390&r2=140391
==============================================================================
--- team/jdixon/chan_usbradio-1.4/dev-1.0/channels/chan_echolink.c (original)
+++ team/jdixon/chan_usbradio-1.4/dev-1.0/channels/chan_echolink.c Wed Aug 27 19:58:27 2008
@@ -29,9 +29,10 @@
  */
 
 /*** MODULEINFO
+	<depend>zlib</depend>
  ***/
 
-/* Version 0.13, 08/27/2008
+/* Version 0.14, 08/27/2008
 Echolink channel driver for Asterisk/app_rpt.
 A lot more has to be added,
 Here is what comes to mind first:
@@ -1468,7 +1469,6 @@
 #define	EL_DIRECTORY_PORT 5200
 #define EL_DB_ROOT "echolink"
 
-
 static void el_zapem(char loading)
 {
 char str[10];
@@ -1499,30 +1499,35 @@
 unsigned char buf[512];
 int	n,i,r;
 
-	if (!compressed)
-	{
-		n = recv(sock,buf1,buf1len - 1,0);
-		if (n < 1) return(-1);
-		return(n);
-	}		
-	memset(buf1,0,buf1len);
-	memset(buf,0,sizeof(buf));
-	n = recv(sock,buf,sizeof(buf) - 1,0);
-	if (n < 1) return(-1); 
-	z->next_in = buf;
-	z->avail_in = n;
-	z->next_out = buf1;
-	z->avail_out = buf1len;
-	i = Z_NO_FLUSH;
-	if (n < (sizeof(buf) - 1)) i = Z_FINISH;
-	r = inflate(z,i);
-	if ((r != Z_OK) && (r != Z_STREAM_END))
-	{
-		if (z->msg)
-			ast_log(LOG_ERROR,"Unable to inflate (Zlib): %s\n",z->msg);
-		else
-			ast_log(LOG_ERROR,"Unable to inflate (Zlib)\n");
-		return -1;
+	for(;;)
+	{
+		if (!compressed)
+		{
+			n = recv(sock,buf1,buf1len - 1,0);
+			if (n < 1) return(-1);
+			return(n);
+		}		
+		memset(buf1,0,buf1len);
+		memset(buf,0,sizeof(buf));
+		n = recv(sock,buf,sizeof(buf) - 1,0);
+		if (n < 0) return(-1);
+		z->next_in = buf;
+		z->avail_in = n;
+		z->next_out = buf1;
+		z->avail_out = buf1len;
+		i = Z_NO_FLUSH;
+		if (n < 1) i = Z_FINISH;
+		r = inflate(z,Z_NO_FLUSH);
+		if ((r != Z_OK) && (r != Z_STREAM_END))
+		{
+			if (z->msg)
+				ast_log(LOG_ERROR,"Unable to inflate (Zlib): %s\n",z->msg);
+			else
+				ast_log(LOG_ERROR,"Unable to inflate (Zlib)\n");
+			return -1;
+		}
+		r = buf1len - z->avail_out;
+		if ((!n) || r) break;
 	}
 	return(buf1len - z->avail_out);
 }
@@ -1559,7 +1564,7 @@
 struct hostent *host;
 struct sockaddr_in dirserver;
 char	str[200],dbstr[100],ipaddr[50],nodenum[50];
-char	dbstr1[100],call[50];
+char	dbstr1[100],call[50],*pp,*cc;
 int	n = 0,rep_lines,delmode;
 int	dir_compressed,dir_partial;
 struct	z_stream_s z;
@@ -1689,7 +1694,6 @@
 	{
 		if (el_net_get_line(sock,str,sizeof(str) - 1,dir_compressed,&z) < 1) break;
 		if (*str <= ' ') break;
-
 		if (!strncmp(str,"+++",3))
 		{
 			if (delmode) break;
@@ -1767,12 +1771,10 @@
 		return -1;
 	}
 	close(sock);
-	if (debug)
-	{
-		ast_log(LOG_DEBUG,"Diretory pgm done downloading, %d records\n",n);
-		ast_log(LOG_DEBUG,"Compressed: %d, Partial: %d\n",dir_compressed,dir_partial);
-		if (dir_compressed) ast_log(LOG_DEBUG,"Got snapshot_id: %s\n",snapshot_id);
-	}
+	pp = (dir_partial) ? "partial" : "full";
+	cc = (dir_compressed) ? "compressed" : "un-compressed";
+	ast_log(LOG_NOTICE,"Diretory pgm done downloading(%s,%s), %d records\n",pp,cc,n);
+	if (debug && dir_compressed) ast_log(LOG_NOTICE,"Got snapshot_id: %s\n",snapshot_id);
 	return(dir_compressed);
 }
 




More information about the asterisk-commits mailing list