=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/sndiod/sock.c,v retrieving revision 1.14 retrieving revision 1.15 diff -c -r1.14 -r1.15 *** src/usr.bin/sndiod/sock.c 2014/11/21 09:05:38 1.14 --- src/usr.bin/sndiod/sock.c 2015/02/16 06:35:17 1.15 *************** *** 1,4 **** ! /* $OpenBSD: sock.c,v 1.14 2014/11/21 09:05:38 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * --- 1,4 ---- ! /* $OpenBSD: sock.c,v 1.15 2015/02/16 06:35:17 ratchov Exp $ */ /* * Copyright (c) 2008-2012 Alexandre Ratchov * *************** *** 514,520 **** { static unsigned char dummy[AMSG_DATAMAX]; unsigned char *data = NULL; - struct abuf *buf = NULL; int n, count; #ifdef DEBUG --- 514,519 ---- *************** *** 539,557 **** #endif return 1; } - if (f->slot) - buf = &f->slot->sub.buf; - else - buf = &f->midi->obuf; while (f->wtodo > 0) { ! data = abuf_rgetblk(buf, &count); if (count > f->wtodo) count = f->wtodo; n = sock_fdwrite(f, data, count); if (n == 0) return 0; f->wtodo -= n; ! abuf_rdiscard(buf, n); } if (f->slot) slot_read(f->slot); --- 538,558 ---- #endif return 1; } while (f->wtodo > 0) { ! if (f->slot) ! data = abuf_rgetblk(&f->slot->sub.buf, &count); ! else if (f->midi) ! data = abuf_rgetblk(&f->midi->obuf, &count); if (count > f->wtodo) count = f->wtodo; n = sock_fdwrite(f, data, count); if (n == 0) return 0; f->wtodo -= n; ! if (f->slot) ! abuf_rdiscard(&f->slot->sub.buf, n); ! else if (f->midi) ! abuf_rdiscard(&f->midi->obuf, n); } if (f->slot) slot_read(f->slot); *************** *** 1002,1008 **** log_puts(": START message\n"); } #endif ! if (f->pstate != SOCK_INIT) { #ifdef DEBUG if (log_level >= 1) { sock_log(f); --- 1003,1009 ---- log_puts(": START message\n"); } #endif ! if (f->pstate != SOCK_INIT || s == NULL) { #ifdef DEBUG if (log_level >= 1) { sock_log(f); *************** *** 1103,1109 **** log_puts(": SETPAR message\n"); } #endif ! if (f->pstate != SOCK_INIT) { #ifdef DEBUG if (log_level >= 1) { sock_log(f); --- 1104,1110 ---- log_puts(": SETPAR message\n"); } #endif ! if (f->pstate != SOCK_INIT || s == NULL) { #ifdef DEBUG if (log_level >= 1) { sock_log(f); *************** *** 1127,1133 **** log_puts(": GETPAR message\n"); } #endif ! if (f->pstate != SOCK_INIT) { #ifdef DEBUG if (log_level >= 1) { sock_log(f); --- 1128,1134 ---- log_puts(": GETPAR message\n"); } #endif ! if (f->pstate != SOCK_INIT || s == NULL) { #ifdef DEBUG if (log_level >= 1) { sock_log(f); *************** *** 1168,1174 **** log_puts(": SETVOL message\n"); } #endif ! if (f->pstate < SOCK_INIT) { #ifdef DEBUG if (log_level >= 1) { sock_log(f); --- 1169,1175 ---- log_puts(": SETVOL message\n"); } #endif ! if (f->pstate < SOCK_INIT || s == NULL) { #ifdef DEBUG if (log_level >= 1) { sock_log(f); *************** *** 1192,1199 **** f->rtodo = sizeof(struct amsg); f->rstate = SOCK_RMSG; f->lastvol = ctl; /* dont trigger feedback message */ - dev_midi_vol(s->dev, s); slot_setvol(s, ctl); break; case AMSG_AUTH: #ifdef DEBUG --- 1193,1200 ---- f->rtodo = sizeof(struct amsg); f->rstate = SOCK_RMSG; f->lastvol = ctl; /* dont trigger feedback message */ slot_setvol(s, ctl); + dev_midi_vol(s->dev, s); break; case AMSG_AUTH: #ifdef DEBUG