private void endOfHeaderProcessing(int i, final int memoIdx, final int stateIdx, Pipe<NetPayloadSchema> localInputPipe, DataOutputBlobWriter<NetResponseSchema> writer) { //logger.trace("end of headers"); positionMemoData[stateIdx] = endOfHeaderProcessing(i, stateIdx, writer); //logger.trace("finished reading header now going to state {}",state); if (3==positionMemoData[stateIdx]) { //release all header bytes, we will do each chunk on its own. assert(runningHeaderBytes[i]>0); Pipe.releasePendingAsReadLock(localInputPipe, runningHeaderBytes[i]); runningHeaderBytes[i] = 0; } //only case where state is not 1 so we must call save all others will call when while loops back to top. TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx); //logger.info("payload position {}", writer.position()); //NOTE: payload index position is always zero DataOutputBlobWriter.setIntBackData(writer, writer.position(), 0); }
private long processHeaderLogic(int i, final int memoIdx, final int stateIdx, Pipe<NetPayloadSchema> localInputPipe, HTTPClientConnection cc, DataOutputBlobWriter<NetResponseSchema> writer) { long headerToken; int startingLength = TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx); //TODO = save position is wrong if we continue??? headerToken = TrieParserReader.parseNext(trieReader, cc.headerParser()); assert(headerToken==-1 || headerToken>=(Integer.MAX_VALUE-2)) : "bad token "+headerToken; int consumed = startingLength - trieReader.sourceLen; runningHeaderBytes[i] += consumed; if (headerToken != -1) { if (HTTPSpecification.END_OF_HEADER_ID != headerToken) { headerProcessing(i, writer, headerToken, cc); //do not change state we want to come back here. } else { endOfHeaderProcessing(i, memoIdx, stateIdx, localInputPipe, writer); } } return headerToken; }
Pipe.markHead(targetPipe); int startingLength1 = TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx); if (startingLength1 >= (revisionMap.shortestKnown()+1)) { runningHeaderBytes[i] += consumed; TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx); TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx); } else { foundWork = 0;//we must exit to give the other stages a chance to fix this issue if (0==chunkRemaining) { int startingLength3 = TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx); TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx); int consumed = startingLength3 - trieReader.sourceLen; int consumed = startingLength3 - trieReader.sourceLen; Pipe.releasePendingAsReadLock(localInputPipe, consumed); TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx); TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx);
TrieParserReader.savePositionMemo(trieReader, positionMemoData, memoIdx); continue;