[Pkg-voip-commits] [dahdi-tools] 23/285: tools: Allow patlooptest to activate and handle buffer events

tzafrir at debian.org tzafrir at debian.org
Thu Jul 7 19:18:21 UTC 2016


This is an automated email from the git hooks/post-receive script.

tzafrir pushed a commit to branch master
in repository dahdi-tools.

commit 4c177ef39c5ec1b33d86ea22f2edb33244bb6ba7
Author: Kinsey Moore <kmoore at digium.com>
Date:   Mon Apr 18 21:20:10 2011 +0000

    tools: Allow patlooptest to activate and handle buffer events
    
    The new buffer events code introduced in revision 9905 gives userspace
    processes an interface to activate detection of buffer over and underflows.
    This change allows patlooptest to take advantage of that feature to better
    inform users of the cause of pattern errors.
    
    Acked-by: Shaun Ruffell <sruffell at digium.com>
    (original patch by Matt Fredrickson)
    
    
    git-svn-id: http://svn.astersk.org/svn/dahdi/tools/trunk@9909 17933a7a-c749-41c5-a318-cba88f637d49
---
 patlooptest.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/patlooptest.c b/patlooptest.c
index 4be399c..2ded0b2 100644
--- a/patlooptest.c
+++ b/patlooptest.c
@@ -208,12 +208,13 @@ int main(int argc, char *argv[])
 			outbuf[x] = c1++;
 		}
 
+write_again:
 		res = write(fd,outbuf,bs);
 		if (res != bs) {
-			printf("Res is %d: %s\n", res, strerror(errno));
-			ioctl(fd, DAHDI_GETEVENT, &x);
-			printf("Event: %d\n", x);
-			exit(1);
+			printf("W: Res is %d: %s\n", res, strerror(errno));
+ 			ioctl(fd, DAHDI_GETEVENT, &x);
+ 			printf("Event: %d\n", x);
+			goto write_again;
 		}
 
 		/* If this is the start of the test then skip a number of packets before test results */
@@ -225,13 +226,18 @@ int main(int argc, char *argv[])
 			if (!skipcount) {
 				printf("Going for it...\n");
 			}
+			i = 1;
+			ioctl(fd,DAHDI_BUFFER_EVENTS, &i);
 			continue;
 		}
 
+read_again:
 		res = read(fd, inbuf, bs);
 		if (res < bs) {
-			printf("read error: returned %d\n", res);
-			exit(1);
+			printf("R: Res is %d\n", res);
+			ioctl(fd, DAHDI_GETEVENT, &x);
+			printf("Event: %d\n", x);
+			goto read_again;
 		}
 		/* If first time through, set byte that is used to test further bytes */
 		if (!setup) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-voip/dahdi-tools.git



More information about the Pkg-voip-commits mailing list