From aa1d4eafd7065fbaf07c64c3ccd116f157bf7541 Mon Sep 17 00:00:00 2001 From: Alexandre Ratchov Date: Wed, 25 Feb 2009 23:32:00 +0000 Subject: after the STOP message is sent, move the receiver to the RMSG state only if it's in the IDLE state, otherwise in some rare cases a data chunk may be interpreted as a message, causing the connection to be dropped. ok deraadt --- lib/libsndio/aucat.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c index e9b46957daa..5bf1fe6a09e 100644 --- a/lib/libsndio/aucat.c +++ b/lib/libsndio/aucat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aucat.c,v 1.14 2009/02/18 07:32:27 ratchov Exp $ */ +/* $OpenBSD: aucat.c,v 1.15 2009/02/25 23:31:59 ratchov Exp $ */ /* * Copyright (c) 2008 Alexandre Ratchov * @@ -304,8 +304,10 @@ aucat_stop(struct sio_hdl *sh) hdl->wtodo = sizeof(struct amsg); if (!aucat_wmsg(hdl)) return 0; - hdl->rstate = STATE_MSG; - hdl->rtodo = sizeof(struct amsg); + if (hdl->rstate == STATE_IDLE) { + hdl->rstate = STATE_MSG; + hdl->rtodo = sizeof(struct amsg); + } /* * wait for the STOP ACK -- cgit v1.2.3