Skip to content

Commit 7ae94f6

Browse files
committed
Process TCP-NO-DELAY option for incoming subscriber connections.
* Check incoming subscriber connection requests for the TCP-NO-DELAY header field and set the TCP-NO-DELAY option on the corresponding channel accordingly.
1 parent ba3dd3e commit 7ae94f6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

rosjava/src/main/java/org/ros/internal/transport/tcp/TcpServerHandshakeHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ private void handleSubscriberHandshake(ChannelHandlerContext ctx, MessageEvent e
9696
DefaultPublisher<?> publisher = topicParticipantManager.getPublisher(topicName);
9797
ChannelBuffer outgoingBuffer = publisher.finishHandshake(incomingConnectionHeader);
9898
Channel channel = ctx.getChannel();
99+
if (incomingConnectionHeader.hasField(ConnectionHeaderFields.TCP_NODELAY)) {
100+
boolean tcpNoDelay = "1".equals(incomingConnectionHeader.getField(ConnectionHeaderFields.TCP_NODELAY));
101+
channel.getConfig().setOption("tcpNoDelay", tcpNoDelay);
102+
}
99103
ChannelFuture future = channel.write(outgoingBuffer).await();
100104
if (!future.isSuccess()) {
101105
throw new RosRuntimeException(future.getCause());

0 commit comments

Comments
 (0)