private void deliverToBuffer() { while (transportBuffer.containsKey(recvBase)) { p(this, 4, "coalescing at recvBase: " + recvBase); dumpState(6); byte[] payload = transportBuffer.get(recvBase).getPayload(); if (recvbb.remaining() >= payload.length) { recvbb.put(payload); recvBase += payload.length; p(this, 5, "coalesced: recvBase incremented to " + recvBase); } else { p(this, 5, "coalesce ending: buffer full"); break; } } }
public void dataReceived(Transport t) { aa(this, isReceiver(), "DATA received by non receiver socket"); aa(this, isConnected(), "DATA received by invalid socket state"); int inSeqNum = t.getSeqNum(); p(this, 3, "dataReceived() seqnum: " + inSeqNum); transportBuffer.put(inSeqNum, t); deliverToBuffer(); dumpState(4); p(this, 3, "ending dataReceived"); tcpMan.sendACK(this.tsid); }