Skip to content

Commit c9981b7

Browse files
author
Ilya Sumbatyants
committed
Add zmq send timeout
1 parent b1a6eca commit c9981b7

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main/java/com/cisco/trex/stateless/TRexTransport.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class TRexTransport {
1616

1717
private static final Logger LOGGER = LoggerFactory.getLogger(TRexTransport.class);
1818

19-
public static final int DEFAULT_RECEIVE_TIMEOUT = 3000;
19+
public static final int DEFAULT_TIMEOUT = 3000;
2020

2121
private final String connectionString;
2222

@@ -30,12 +30,13 @@ public class TRexTransport {
3030

3131
private String port;
3232

33-
public TRexTransport(String host, String port, int receiveTimeout) {
33+
public TRexTransport(String host, String port, int timeout) {
3434
this.host = host;
3535
this.port = port;
3636
zmqSocket = zmqCtx.socket(ZMQ.REQ);
37-
int timeout = receiveTimeout == 0 ? DEFAULT_RECEIVE_TIMEOUT : receiveTimeout;
38-
zmqSocket.setReceiveTimeOut(timeout);
37+
int actualTimeout = timeout <= 0 ? DEFAULT_TIMEOUT : timeout;
38+
zmqSocket.setReceiveTimeOut(actualTimeout);
39+
zmqSocket.setSendTimeOut(actualTimeout);
3940
connectionString = protocol + "://"+ this.host +":" + this.port;
4041
zmqSocket.connect(connectionString);
4142
}

0 commit comments

Comments
 (0)