free(newbuf);
p = hub->inbuf;
hub->inbufdata += datalen;
- while((datalen > 0) && ((p2 = memchr(p, '|', datalen)) != NULL))
+ while((p - hub->inbuf < hub->inbufdata) && ((p2 = memchr(p, '|', hub->inbufdata - (p - hub->inbuf))) != NULL))
{
*(p2++) = 0;
for(cmd = hubcmds; cmd->handler != NULL; cmd++)
}
if((cmd->limit == 0) || (hub->queue.size < cmd->limit))
newqcmd(&hub->queue, p);
- datalen -= p2 - p;
p = p2;
}
memmove(hub->inbuf, p, hub->inbufdata -= p - hub->inbuf);
peer->transfer->close = 1;
if(peer->transfer->dir == TRNSD_DOWN)
resettransfer(peer->transfer);
- transferdetach(peer->transfer);
}
if(peer->timeout != NULL)
canceltimer(peer->timeout);