public ClientConnection connection(int idx, ClientCoordinator ccm, Pipe<NetPayloadSchema>[] outputs) { ClientConnection result = ClientCoordinator.openConnection( ccm, members[idx].hostId, members[idx].port, members[idx].sessionId, ClientHostPortInstance.getTargetResponsePipeIdx(members[idx]), outputs, members[idx].getConnectionId(), BasicClientConnectionFactory.instance); members[idx].setConnectionId(result.getId()); return result; }
private void beginHandshakeNow(Pipe<NetPayloadSchema>[] handshakeBegin) throws SSLException { logger.trace("\nbegin handshake for : {} pipes:{} ",getId(),handshakeBegin.length); Pipe.addLongValue(getId(), pipe); Pipe.addLongValue(System.currentTimeMillis(), pipe); Pipe.addLongValue(SSLUtil.HANDSHAKE_POS, pipe);
private void abandonNow(ClientConnection abandonded) { Pipe<NetPayloadSchema> pipe = output[abandonded.getResponsePipeIdx()]; ///ensure that this will not cause any stall, better to skip this than be blocked. if (Pipe.hasRoomForWrite(pipe)) { long nowNS = System.nanoTime(); long callTime = abandonded.outstandingCallTime(nowNS); logger.warn("\nClient disconnected {} con:{} session:{} because call was taking too long. Estimated:{}", abandonded, abandonded.id, abandonded.sessionId,Appendables.appendNearestTimeUnit(new StringBuilder(), callTime)); abandonded.touchSentTime(nowNS);//rest the timeout so we do not attempt to close this again until the timeout has passed again. if (!abandonded.isDisconnecting()) { abandonded.beginDisconnect(); } int size = Pipe.addMsgIdx(pipe, NetPayloadSchema.MSG_DISCONNECT_203); Pipe.addLongValue(abandonded.getId(), pipe); Pipe.confirmLowLevelWrite(pipe, size); Pipe.publishWrites(pipe); //Do not set notification sent this message will trigger that one later once it makes it down the pipe. } }
writePlain(cc, target, readCount); } else { writeEncrypted(cc.getId(), target, readCount);
Pipe.addLongValue(cc.getId(), target); //connection Pipe.addLongValue(System.nanoTime(), target);
public static void cleanCloseConnection(Pipe<ClientHTTPRequestSchema> requestPipe, ClientConnection connectionToKill, Pipe<NetPayloadSchema> pipe) { //must consume each field so we can move forward, this is required or the position will be off... //matches ClientHTTPRequestSchema.MSG_CLOSECONNECTION_104 int session = Pipe.takeInt(requestPipe); int port = Pipe.takeInt(requestPipe); int hostId = Pipe.takeInt(requestPipe); long conId = Pipe.takeLong(requestPipe); //do not close that will be done by last stage //must be done first before we send the message connectionToKill.beginDisconnect(); Pipe.presumeRoomForWrite(pipe); int size = Pipe.addMsgIdx(pipe, NetPayloadSchema.MSG_DISCONNECT_203); Pipe.addLongValue(connectionToKill.getId(), pipe);// NetPayloadSchema.MSG_DISCONNECT_203_FIELD_CONNECTIONID_201, connectionToKill.getId()); Pipe.confirmLowLevelWrite(pipe, size); Pipe.publishWrites(pipe); }
long connectionId = connection.getId(); if (!sendSingleMessage(pipe[useUsersPipe], connectionId, testSeeds[testIdx], testSizes[testIdx])){ return;//try again later