static int handleNextMessage(sender_state_t sendst, struct slice *xmitSlice, struct slice *rexmitSlice) { int pos = pc_getConsumerPosition(sendst->rc.incoming); union message *msg = &sendst->rc.q[pos].msg; int clNo = sendst->rc.q[pos].clNo; #if DEBUG flprintf("handle next message\n"); #endif pc_consumeAny(sendst->rc.incoming); switch(ntohs(msg->opCode)) { case CMD_OK: handleOk(sendst, findSlice(xmitSlice, rexmitSlice, ntohl(msg->ok.sliceNo)), clNo); break; case CMD_DISCONNECT: handleDisconnect(sendst->rc.participantsDb, xmitSlice, rexmitSlice, clNo); break; case CMD_RETRANSMIT: #if DEBUG flprintf("Received retransmittal request for %ld from %d:\n", (long) xtohl(msg->retransmit.sliceNo), clNo); #endif handleRetransmit(sendst, findSlice(xmitSlice, rexmitSlice, ntohl(msg->retransmit.sliceNo)), clNo, msg->retransmit.map, msg->retransmit.rxmit); break; default: udpc_flprintf("Bad command %04x\n", (unsigned short) msg->opCode); break; } pc_consumed(sendst->rc.incoming, 1); pc_produce(sendst->rc.freeSpace, 1); return 0; }
const Slice * FrameBuffer::findSlice (const string &name) const { return findSlice (name.c_str()); }