Module Name:    src
Committed By:   nat
Date:           Sun Aug 27 10:39:18 UTC 2017

Modified Files:
        src/usr.sbin/bta2dpd/bta2dpd: bta2dpd.c

Log Message:
Connection state machine improvement upon transition from AVDTP_OPEN to
AVDTP_START/SUSPEND.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.3 src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.4
--- src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c:1.3	Sat May 27 10:04:57 2017
+++ src/usr.sbin/bta2dpd/bta2dpd/bta2dpd.c	Sun Aug 27 10:39:18 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: bta2dpd.c,v 1.3 2017/05/27 10:04:57 nat Exp $ */
+/* $NetBSD: bta2dpd.c,v 1.4 2017/08/27 10:39:18 nat Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss <nathanialsl...@yahoo.com.au>
@@ -674,7 +674,8 @@ do_ctlreq(int fd, short ev, void *arg)
 		case AVDTP_SUSPEND:
 		case AVDTP_START:
 			avdtpSendAccept(fd, fd, trans, signal);
-			state = 6;
+			if (state < 6)
+				state = 6;
 			break;
 		default:
 			avdtpSendReject(fd, fd, trans, signal);
@@ -717,7 +718,8 @@ do_ctlreq(int fd, short ev, void *arg)
 			break;
 		case AVDTP_SUSPEND:
 		case AVDTP_START:
-			state = 6;
+			if (state < 6)
+				state = 6;
 			break;
 		default:
 			avdtpSendReject(fd, fd, trans, signal);
@@ -730,7 +732,7 @@ do_ctlreq(int fd, short ev, void *arg)
 	if (state < 5 || state > 7)
 		return;
 
-	if (asSpeaker) {
+	if (asSpeaker && state == 6) {
 		len = sizeof(addr);
 		if ((sc = accept(orighc,(struct sockaddr*)&addr, &len)) < 0)
 			err(EXIT_FAILURE, "stream accept");

Reply via email to