summaryrefslogtreecommitdiffstats
path: root/lib/libsndio
diff options
context:
space:
mode:
authorratchov <ratchov@openbsd.org>2010-06-05 12:45:48 +0000
committerratchov <ratchov@openbsd.org>2010-06-05 12:45:48 +0000
commitafc185e5ee85104641566d77ba7b8d142b3b4827 (patch)
treecbf41a3f72f6f5cec0d41cf1d36f2735c0910746 /lib/libsndio
parentuse lock_db(unshared), since we may tweak things (diff)
downloadwireguard-openbsd-afc185e5ee85104641566d77ba7b8d142b3b4827.tar.xz
wireguard-openbsd-afc185e5ee85104641566d77ba7b8d142b3b4827.zip
Don't send the initial position as a clock tick with a negative delta.
Add a new ``initial position'' message which is simpler. No bahaviour change, except effects of the protocol version crank.
Diffstat (limited to 'lib/libsndio')
-rw-r--r--lib/libsndio/aucat.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/libsndio/aucat.c b/lib/libsndio/aucat.c
index 9ed8f8795cf..27ea95c26d3 100644
--- a/lib/libsndio/aucat.c
+++ b/lib/libsndio/aucat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aucat.c,v 1.38 2010/05/25 06:51:28 ratchov Exp $ */
+/* $OpenBSD: aucat.c,v 1.39 2010/06/05 12:45:48 ratchov Exp $ */
/*
* Copyright (c) 2008 Alexandre Ratchov <alex@caoua.org>
*
@@ -150,16 +150,19 @@ aucat_runmsg(struct aucat_hdl *hdl)
hdl->rstate = STATE_DATA;
hdl->rtodo = hdl->rmsg.u.data.size;
break;
+ case AMSG_POS:
+ DPRINTF("aucat: pos = %d, maxwrite = %u\n",
+ hdl->rmsg.u.ts.delta, hdl->maxwrite);
+ hdl->rstate = STATE_MSG;
+ hdl->rtodo = sizeof(struct amsg);
+ break;
case AMSG_MOVE:
- DPRINTF("aucat: tick, delta = %d\n", hdl->rmsg.u.ts.delta);
- if (hdl->rmsg.u.ts.delta > 0)
- hdl->maxwrite += hdl->rmsg.u.ts.delta * hdl->wbpf;
+ hdl->maxwrite += hdl->rmsg.u.ts.delta * hdl->wbpf;
hdl->delta += hdl->rmsg.u.ts.delta;
- if (hdl->delta >= 0) {
- DPRINTF("aucat: move: maxwrite = %d\n", hdl->maxwrite);
- sio_onmove_cb(&hdl->sio, hdl->delta);
- hdl->delta = 0;
- }
+ DPRINTF("aucat: tick = %d, maxwrite = %u\n",
+ hdl->rmsg.u.ts.delta, hdl->maxwrite);
+ sio_onmove_cb(&hdl->sio, hdl->delta);
+ hdl->delta = 0;
hdl->rstate = STATE_MSG;
hdl->rtodo = sizeof(struct amsg);
break;