--- hobbit.rcs/hobbitd/hobbitd_worker.c 2006/11/23 21:12:13 1.31 +++ hobbit.rcs/hobbitd/hobbitd_worker.c 2007/05/28 07:45:26 1.32 @@ -387,11 +387,10 @@ } /* - * If the start of the next message doesn't begin with "@@" then + * If the start of the next message doesn't begin with "@" then * there's something rotten. - * It might be some data left-over from an oversized message. */ - if (*startpos && strncmp(startpos, "@@", 2) != 0) { + if (*startpos && (*startpos != '@')) { errprintf("Bad data in channel, skipping it\n"); startpos = strstr(startpos, "\n@@"); endpos = (startpos ? strstr(startpos, "\n@@\n") : NULL); @@ -401,8 +400,10 @@ } if (!startpos) { - startpos = buf; - fillpos = buf; + /* We're lost - flush the buffer and try to recover */ + errprintf("Buffer sync lost, flushing data\n"); + *buf = '\0'; + startpos = fillpos = buf; endpos = NULL; }