From: Richard Kettlewell Date: Sun, 13 Dec 2009 15:53:42 +0000 (+0000) Subject: Ensure we still send a 'completed' event in various dubious edge X-Git-Tag: 5.0~24 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/f3102c220cd8142a0281f3b487b8c6157672ae7c Ensure we still send a 'completed' event in various dubious edge cases, especially common in scratching. --- diff --git a/server/play.c b/server/play.c index aa5b8c7..9f54d61 100644 --- a/server/play.c +++ b/server/play.c @@ -83,8 +83,13 @@ static int speaker_readable(ev_source *ev, int fd, case SM_FINISHED: /* scratched the playing track */ case SM_STILLBORN: /* scratched too early */ case SM_UNKNOWN: /* scratched WAY too early */ - if(playing && !strcmp(sm.id, playing->id)) + if(playing && !strcmp(sm.id, playing->id)) { + if((playing->state == playing_unplayed + || playing->state == playing_started) + && sm.type == SM_FINISHED) + playing->state = playing_ok; finished(ev); + } break; case SM_PLAYING: /* track ID is playing, DATA seconds played */