public static ServerSocketReaderStage newInstance(GraphManager graphManager, Pipe<ReleaseSchema>[] ack, Pipe<NetPayloadSchema>[] output, ServerCoordinator coordinator) { return new ServerSocketReaderStage(graphManager, ack, output, coordinator); }
while (hasNewDataToRead()) { releasePipesForUse(); selectedKeys.forEach(selectionKeyAction); removeDoneKeys(selectedKeys); if (!hasRoomForMore) { return; requestShutdown(); return;
private boolean processSelection(SelectionKey selection) { assert isRead(selection) : "only expected read"; final SocketChannel socketChannel = (SocketChannel)selection.channel(); //get the context object so we know what the channel identifier is ConnectionContext connectionContext = (ConnectionContext)selection.attachment(); long channelId = connectionContext.getChannelId(); assert(channelId>=0); //logger.info("\nnew key selection in reader for connection {}",channelId); return processConnection(selection, socketChannel, channelId, coordinator.lookupConnectionById(channelId)); }
if (null != cc) { assert(cc.getSocketChannel()==socketChannel) : "internal error"; handshakeProcessing(cc); responsePipeLineIdx = lookupResponsePipeLineIdx(channelId, cc); if (pumpByteChannelIntoPipe(socketChannel, cc.id, cc.getSequenceNo(), output[responsePipeLineIdx], return processClosedConnection(socketChannel, channelId);
readMaxSize); assert(collectRemainingCount(b)); assert(readCountMatchesLength(len, b)); return publishData(channelId, sequenceNo, targetPipe, len, b, true, newBeginning); } else { Pipe.unstoreBlobWorkingHeadPosition(targetPipe); responsePipeLinePool.release(channelId); int result = abandonConnection(channelId, targetPipe, false, newBeginning); int result; if (len>0) { result = publishData(channelId, cc.getSequenceNo(), targetPipe, len, b, isOpen, newBeginning); } else { result = abandonConnection(channelId, targetPipe, isOpen, newBeginning);
ServerSocketReaderStage.newInstance(gm, acks, output, serverCoord); SocketTestDataStage watch = new SocketTestDataStage(gm, output, acks[0], encryptedContent, testUsers, testSeeds, testSizes);
ServerSocketReaderStage.newInstance(gm, releasePipes, output, serverCoord); new ServerSocketWriterStage(gm, serverCoord, output, releasePipes[0]);
private static void buildSocketReaderGroups(final GraphManager graphManager, final ServerCoordinator coordinator, final Pipe<NetPayloadSchema>[] encryptedIncomingGroup, Pipe<ReleaseSchema>[] acks, int groups) { Pipe[][] in = Pipe.splitPipes(groups, encryptedIncomingGroup); Pipe[][] out = Pipe.splitPipes(groups, acks); for(int x=0; x<groups; x++) { ServerSocketReaderStage readerStage = new ServerSocketReaderStage(graphManager, out[(groups-x)-1], in[x], coordinator); GraphManager.addNota(graphManager, GraphManager.DOT_RANK_NAME, "SocketReader", readerStage); coordinator.processNota(graphManager, readerStage); } }
public static void buildSimpleTLSServer(GraphManager graphManager, ServerCoordinator serverCoordinator, Pipe<NetPayloadSchema>[] serverPlainInput, Pipe<NetPayloadSchema>[] serverPlainOutput) { Pipe<ReleaseSchema>[] serverReleaseAck = new Pipe[] {ReleaseSchema.instance.newPipe(1024, 0)}; Pipe<NetPayloadSchema>[] serverHandshakePipe = new Pipe[] {NetPayloadSchema.instance.newPipe(8, 1<<16)}; Pipe<NetPayloadSchema>[] serverEncryptedInput = Pipe.buildPipes(serverPlainInput); Pipe<NetPayloadSchema>[] serverEncryptedOutput = Pipe.buildPipes(serverPlainOutput); ServerSocketReaderStage reader = new ServerSocketReaderStage(graphManager, serverReleaseAck, serverEncryptedInput, serverCoordinator); GraphManager.addNota(graphManager, GraphManager.DOT_RANK_NAME, "socket reader", reader); SSLEngineUnWrapStage unwrap = new SSLEngineUnWrapStage(graphManager, serverCoordinator, serverEncryptedInput, serverPlainInput, serverReleaseAck[0], serverHandshakePipe[0], true /*isServer*/); GraphManager.addNota(graphManager, GraphManager.DOT_RANK_NAME, "socket unwrap", unwrap); new SSLEngineWrapStage(graphManager, serverCoordinator, true /*isServer*/, serverPlainOutput, serverEncryptedOutput); new ServerSocketWriterStage(graphManager, serverCoordinator, PronghornStage.join(serverEncryptedOutput, serverHandshakePipe)); }
ServerSocketReaderStage readerStage = new ServerSocketReaderStage(graphManager, acks, encryptedIncomingGroup, coordinator); GraphManager.addNota(graphManager, GraphManager.DOT_RANK_NAME, "SocketReader", readerStage); coordinator.processNota(graphManager, readerStage);