[asterisk-commits] wedhorn: branch wedhorn/packet-fragmentation r382225 - /team/wedhorn/packet-f...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 28 01:10:33 CST 2013


Author: wedhorn
Date: Thu Feb 28 01:10:30 2013
New Revision: 382225

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382225
Log:
Commit AST-20988 patch and additional log message

Modified:
    team/wedhorn/packet-fragmentation/channels/chan_skinny.c

Modified: team/wedhorn/packet-fragmentation/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/wedhorn/packet-fragmentation/channels/chan_skinny.c?view=diff&rev=382225&r1=382224&r2=382225
==============================================================================
--- team/wedhorn/packet-fragmentation/channels/chan_skinny.c (original)
+++ team/wedhorn/packet-fragmentation/channels/chan_skinny.c Thu Feb 28 01:10:30 2013
@@ -7509,13 +7509,24 @@
 		}
 		*bufaddr = htolel(dlen);
 
-		res = read(s->fd, s->inbuf+4, dlen+4);
+		res = 0;
+		do {
+			int bytesread = res;
+			if (res > 0) {
+				ast_log(LOG_WARNING, "packet fragment - please add the few lines around this to ASTERISK-20988\n");
+			}
+			res = read(s->fd, s->inbuf+4+bytesread, dlen+4-bytesread);
+			if (res < 0) {
+				ast_log(LOG_WARNING, "read() returned error: %s\n", strerror(errno));
+				ast_mutex_unlock(&s->lock);
+				return res;
+			}
+			res += bytesread;
+		} while (res < (dlen + 4));
 		ast_mutex_unlock(&s->lock);
-		if (res < 0) {
-			ast_log(LOG_WARNING, "read() returned error: %s\n", strerror(errno));
-			return res;
-		} else if (res != (dlen+4)) {
-			ast_log(LOG_WARNING, "Skinny Client sent less data than expected.\n");
+
+		if (res != (dlen+4)) {
+			ast_log(LOG_WARNING, "Skinny Client sent more data than expected.\n");
 			return -1;
 		}
 		return res;




More information about the asterisk-commits mailing list