|
1 | 1 | package org.ros.node.topic;
|
2 | 2 |
|
3 |
| -import java.util.Map; |
4 |
| - |
5 |
| -import org.ros.internal.transport.ConnectionHeaderFields; |
6 | 3 | import org.ros.node.ConnectedNode;
|
7 | 4 |
|
8 |
| -import com.google.common.collect.Maps; |
9 |
| - |
10 | 5 |
|
11 | 6 | /**
|
12 | 7 | * Provides a way of specifying network transport hints to
|
13 |
| - * {@link ConnectedNode#newSubscriber(String, String)} and |
14 |
| - * {@link ConnectedNode#newSubscriber(org.ros.namespace.GraphName, String)}. |
| 8 | + * {@link ConnectedNode#newSubscriber(org.ros.namespace.GraphName, String, TransportHints)} and |
| 9 | + * {@link ConnectedNode#newSubscriber(String, String, TransportHints)}. |
15 | 10 | *
|
16 | 11 | * @author [email protected] (Stefan Glaser)
|
17 | 12 | */
|
18 | 13 | public class TransportHints {
|
19 | 14 |
|
20 |
| - Map<String, String> options; |
| 15 | + private boolean tcpNoDelay; |
21 | 16 |
|
22 |
| - public TransportHints() { |
23 |
| - this.options = Maps.newConcurrentMap(); |
| 17 | + public TransportHints() { |
| 18 | + this(false); |
24 | 19 | }
|
25 | 20 |
|
26 | 21 | public TransportHints(boolean tcpNoDelay) {
|
27 |
| - tcpNoDelay(tcpNoDelay); |
| 22 | + this.tcpNoDelay = tcpNoDelay; |
28 | 23 | }
|
29 | 24 |
|
30 |
| - public TransportHints tcpNoDelay(boolean nodelay) { |
31 |
| - options.put(ConnectionHeaderFields.TCP_NODELAY, nodelay ? "1" : "0"); |
32 |
| - |
| 25 | + public TransportHints tcpNoDelay(boolean tcpNoDelay) { |
| 26 | + this.tcpNoDelay = tcpNoDelay; |
33 | 27 | return this;
|
34 | 28 | }
|
35 | 29 |
|
36 | 30 | public boolean getTcpNoDelay() {
|
37 |
| - return "1".equals(options.get(ConnectionHeaderFields.TCP_NODELAY)); |
38 |
| - } |
39 |
| - |
40 |
| - public Map<String, String> getOptions() { |
41 |
| - return options; |
| 31 | + return tcpNoDelay; |
42 | 32 | }
|
43 | 33 | }
|
0 commit comments