public String toString() { final StringBuilder sb = new StringBuilder(); final String formattedFlags = String.format("%1$8s", Integer.toBinaryString(flags())).replace(' ', '0'); sb.append("RTT Measure Message{") .append("frame_length=").append(frameLength()) .append(" version=").append(version()) .append(" flags=").append(formattedFlags) .append(" type=").append(headerType()) .append(" session_id=").append(sessionId()) .append(" stream_id=").append(streamId()) .append(" echo_timestamp=").append(echoTimestampNs()) .append(" reception_delta=").append(receptionDelta()) .append(" receiver_id=").append(receiverId()) .append("}"); return sb.toString(); } }
private static void dissect(final RttMeasurementFlyweight msg, final StringBuilder builder) { builder .append("RTT ") .append(msg.flags()) .append(" len ") .append(msg.frameLength()) .append(' ') .append(msg.sessionId()) .append(':') .append(msg.streamId()) .append(' ') .append(msg.echoTimestampNs()) .append(' ') .append(msg.receptionDelta()) .append(' ') .append(msg.receiverId()); }
/** * Called from the {@link Receiver} upon receiving an RTT Measurement that is a reply. * * @param header of the measurement message. * @param transportIndex that the RTT Measurement came in on. * @param srcAddress from the sender requesting the measurement */ void onRttMeasurement( final RttMeasurementFlyweight header, @SuppressWarnings("unused") final int transportIndex, final InetSocketAddress srcAddress) { final long nowNs = nanoClock.nanoTime(); final long rttInNs = nowNs - header.echoTimestampNs() - header.receptionDelta(); congestionControl.onRttMeasurement(nowNs, rttInNs, srcAddress); }
public void onRttMeasurement( final RttMeasurementFlyweight msg, @SuppressWarnings("unused") final InetSocketAddress srcAddress) { if (RttMeasurementFlyweight.REPLY_FLAG == (msg.flags() & RttMeasurementFlyweight.REPLY_FLAG)) { // TODO: rate limit rttMeasurementHeader .receiverId(msg.receiverId()) .echoTimestampNs(msg.echoTimestampNs()) .receptionDelta(0) .sessionId(sessionId) .streamId(streamId) .flags((short)0x0); final int bytesSent = channelEndpoint.send(rttMeasurementBuffer); if (RttMeasurementFlyweight.HEADER_LENGTH != bytesSent) { shortSends.increment(); } } // handling of RTT measurements would be done in an else clause here. }
public void sendRttMeasurement( final ImageConnection[] controlAddresses, final int sessionId, final int streamId, final long echoTimestampNs, final long receptionDelta, final boolean isReply) { if (!isClosed) { rttMeasurementFlyweight .sessionId(sessionId) .streamId(streamId) .receiverId(receiverId) .echoTimestampNs(echoTimestampNs) .receptionDelta(receptionDelta) .flags(isReply ? RttMeasurementFlyweight.REPLY_FLAG : 0); send(rttMeasurementBuffer, RttMeasurementFlyweight.HEADER_LENGTH, controlAddresses); } }
public void onRttMeasurement( final ReceiveChannelEndpoint channelEndpoint, final RttMeasurementFlyweight header, final InetSocketAddress srcAddress, final int transportIndex) { final int streamId = header.streamId(); final StreamInterest streamInterest = streamInterestByIdMap.get(streamId); if (null != streamInterest) { final int sessionId = header.sessionId(); final SessionInterest sessionInterest = streamInterest.sessionInterestByIdMap.get(sessionId); if (null != sessionInterest && null != sessionInterest.image) { if (RttMeasurementFlyweight.REPLY_FLAG == (header.flags() & RttMeasurementFlyweight.REPLY_FLAG)) { // TODO: check rate limit final InetSocketAddress controlAddress = channelEndpoint.isMulticast(transportIndex) ? channelEndpoint.udpChannel(transportIndex).remoteControl() : srcAddress; channelEndpoint.sendRttMeasurement( transportIndex, controlAddress, sessionId, streamId, header.echoTimestampNs(), 0, false); } else { sessionInterest.image.onRttMeasurement(header, transportIndex, srcAddress); } } } }
.streamId(streamId) .receiverId(receiverId) .echoTimestampNs(echoTimestampNs) .receptionDelta(receptionDelta) .flags(isReply ? RttMeasurementFlyweight.REPLY_FLAG : 0);
private static void dissect(final RttMeasurementFlyweight msg, final StringBuilder builder) { builder .append("RTT ") .append(msg.flags()) .append(" len ") .append(msg.frameLength()) .append(' ') .append(msg.sessionId()) .append(':') .append(msg.streamId()) .append(' ') .append(msg.echoTimestampNs()) .append(' ') .append(msg.receptionDelta()) .append(' ') .append(msg.receiverId()); }
public String toString() { final StringBuilder sb = new StringBuilder(); final String formattedFlags = String.format("%1$8s", Integer.toBinaryString(flags())).replace(' ', '0'); sb.append("RTT Measure Message{") .append("frame_length=").append(frameLength()) .append(" version=").append(version()) .append(" flags=").append(formattedFlags) .append(" type=").append(headerType()) .append(" session_id=").append(sessionId()) .append(" stream_id=").append(streamId()) .append(" echo_timestamp=").append(echoTimestampNs()) .append(" reception_delta=").append(receptionDelta()) .append(" receiver_id=").append(receiverId()) .append("}"); return sb.toString(); } }
public String toString() { final StringBuilder sb = new StringBuilder(); final String formattedFlags = String.format("%1$8s", Integer.toBinaryString(flags())).replace(' ', '0'); sb.append("RTT Measure Message{") .append("frame_length=").append(frameLength()) .append(" version=").append(version()) .append(" flags=").append(formattedFlags) .append(" type=").append(headerType()) .append(" session_id=").append(sessionId()) .append(" stream_id=").append(streamId()) .append(" echo_timestamp=").append(echoTimestampNs()) .append(" reception_delta=").append(receptionDelta()) .append(" receiver_id=").append(receiverId()) .append("}"); return sb.toString(); } }
/** * Called from the {@link Receiver} upon receiving an RTT Measurement that is a reply. * * @param header of the measurement message. * @param transportIndex that the RTT Measurement came in on. * @param srcAddress from the sender requesting the measurement */ void onRttMeasurement( final RttMeasurementFlyweight header, @SuppressWarnings("unused") final int transportIndex, final InetSocketAddress srcAddress) { final long nowNs = nanoClock.nanoTime(); final long rttInNs = nowNs - header.echoTimestampNs() - header.receptionDelta(); congestionControl.onRttMeasurement(nowNs, rttInNs, srcAddress); }
/** * Called from the {@link Receiver} upon receiving an RTT Measurement that is a reply. * * @param header of the measurement message. * @param transportIndex that the RTT Measurement came in on. * @param srcAddress from the sender requesting the measurement */ void onRttMeasurement( final RttMeasurementFlyweight header, @SuppressWarnings("unused") final int transportIndex, final InetSocketAddress srcAddress) { final long nowNs = nanoClock.nanoTime(); final long rttInNs = nowNs - header.echoTimestampNs() - header.receptionDelta(); congestionControl.onRttMeasurement(nowNs, rttInNs, srcAddress); }
public void onRttMeasurement( final RttMeasurementFlyweight msg, @SuppressWarnings("unused") final InetSocketAddress srcAddress) { if (RttMeasurementFlyweight.REPLY_FLAG == (msg.flags() & RttMeasurementFlyweight.REPLY_FLAG)) { // TODO: rate limit rttMeasurementHeader .receiverId(msg.receiverId()) .echoTimestampNs(msg.echoTimestampNs()) .receptionDelta(0) .sessionId(sessionId) .streamId(streamId) .flags((short)0x0); final int bytesSent = channelEndpoint.send(rttMeasurementBuffer); if (RttMeasurementFlyweight.HEADER_LENGTH != bytesSent) { shortSends.increment(); } } // handling of RTT measurements would be done in an else clause here. }
public void onRttMeasurement( final RttMeasurementFlyweight msg, @SuppressWarnings("unused") final InetSocketAddress srcAddress) { if (RttMeasurementFlyweight.REPLY_FLAG == (msg.flags() & RttMeasurementFlyweight.REPLY_FLAG)) { // TODO: rate limit rttMeasurementHeader .receiverId(msg.receiverId()) .echoTimestampNs(msg.echoTimestampNs()) .receptionDelta(0) .sessionId(sessionId) .streamId(streamId) .flags((short)0x0); final int bytesSent = channelEndpoint.send(rttMeasurementBuffer); if (RttMeasurementFlyweight.HEADER_LENGTH != bytesSent) { shortSends.increment(); } } // handling of RTT measurements would be done in an else clause here. }
public void sendRttMeasurement( final ImageConnection[] controlAddresses, final int sessionId, final int streamId, final long echoTimestampNs, final long receptionDelta, final boolean isReply) { if (!isClosed) { rttMeasurementFlyweight .sessionId(sessionId) .streamId(streamId) .receiverId(receiverId) .echoTimestampNs(echoTimestampNs) .receptionDelta(receptionDelta) .flags(isReply ? RttMeasurementFlyweight.REPLY_FLAG : 0); send(rttMeasurementBuffer, RttMeasurementFlyweight.HEADER_LENGTH, controlAddresses); } }
public void sendRttMeasurement( final ImageConnection[] controlAddresses, final int sessionId, final int streamId, final long echoTimestampNs, final long receptionDelta, final boolean isReply) { if (!isClosed) { rttMeasurementFlyweight .sessionId(sessionId) .streamId(streamId) .receiverId(receiverId) .echoTimestampNs(echoTimestampNs) .receptionDelta(receptionDelta) .flags(isReply ? RttMeasurementFlyweight.REPLY_FLAG : 0); send(rttMeasurementBuffer, RttMeasurementFlyweight.HEADER_LENGTH, controlAddresses); } }
public void onRttMeasurement( final ReceiveChannelEndpoint channelEndpoint, final RttMeasurementFlyweight header, final InetSocketAddress srcAddress, final int transportIndex) { final int streamId = header.streamId(); final StreamInterest streamInterest = streamInterestByIdMap.get(streamId); if (null != streamInterest) { final int sessionId = header.sessionId(); final SessionInterest sessionInterest = streamInterest.sessionInterestByIdMap.get(sessionId); if (null != sessionInterest && null != sessionInterest.image) { if (RttMeasurementFlyweight.REPLY_FLAG == (header.flags() & RttMeasurementFlyweight.REPLY_FLAG)) { // TODO: check rate limit final InetSocketAddress controlAddress = channelEndpoint.isMulticast(transportIndex) ? channelEndpoint.udpChannel(transportIndex).remoteControl() : srcAddress; channelEndpoint.sendRttMeasurement( transportIndex, controlAddress, sessionId, streamId, header.echoTimestampNs(), 0, false); } else { sessionInterest.image.onRttMeasurement(header, transportIndex, srcAddress); } } } }
public void onRttMeasurement( final ReceiveChannelEndpoint channelEndpoint, final RttMeasurementFlyweight header, final InetSocketAddress srcAddress, final int transportIndex) { final int streamId = header.streamId(); final StreamInterest streamInterest = streamInterestByIdMap.get(streamId); if (null != streamInterest) { final int sessionId = header.sessionId(); final SessionInterest sessionInterest = streamInterest.sessionInterestByIdMap.get(sessionId); if (null != sessionInterest && null != sessionInterest.image) { if (RttMeasurementFlyweight.REPLY_FLAG == (header.flags() & RttMeasurementFlyweight.REPLY_FLAG)) { // TODO: check rate limit final InetSocketAddress controlAddress = channelEndpoint.isMulticast(transportIndex) ? channelEndpoint.udpChannel(transportIndex).remoteControl() : srcAddress; channelEndpoint.sendRttMeasurement( transportIndex, controlAddress, sessionId, streamId, header.echoTimestampNs(), 0, false); } else { sessionInterest.image.onRttMeasurement(header, transportIndex, srcAddress); } } } }
.streamId(streamId) .receiverId(receiverId) .echoTimestampNs(echoTimestampNs) .receptionDelta(receptionDelta) .flags(isReply ? RttMeasurementFlyweight.REPLY_FLAG : 0);
.streamId(streamId) .receiverId(receiverId) .echoTimestampNs(echoTimestampNs) .receptionDelta(receptionDelta) .flags(isReply ? RttMeasurementFlyweight.REPLY_FLAG : 0);