diff options
author | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-02-25 23:32:00 +0000 |
---|---|---|
committer | Alexandre Ratchov <ratchov@cvs.openbsd.org> | 2009-02-25 23:32:00 +0000 |
commit | aa1d4eafd7065fbaf07c64c3ccd116f157bf7541 (patch) | |
tree | 406b11d3440f2c998dd32d9a899c2ef3b6757da8 | |
parent | 184bf0c4485793e104c9bf4074197d14c4589a6d (diff) |
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
-rw-r--r-- | lib/libsndio/aucat.c | 8 |
1 files 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 <alex@caoua.org> * @@ -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 |