Skip to content

Commit

Permalink
- Set TUNNEL.port_range to 0 in init() (https://issues.redhat.com/bro…
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Jul 3, 2024
1 parent 974a536 commit b3ad28c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion conf/tunnel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<TUNNEL
gossip_router_hosts="${jgroups.tunnel.gossip_router_hosts:localhost[12001]}"
port_range="${jgroups.tunnel.port_range:5}"/>
port_range="${jgroups.tunnel.port_range:0}"/>
<PING/>
<MERGE3/>
<FD_ALL3/>
Expand Down
6 changes: 5 additions & 1 deletion src/org/jgroups/protocols/TUNNEL.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public TUNNEL setGossipRouterHosts(String hosts) throws UnknownHostException {
// if we get passed value of List<SocketAddress>#toString() we have to strip []
if(hosts.startsWith("[") && hosts.endsWith("]"))
hosts=hosts.substring(1, hosts.length() - 1);
gossip_router_hosts=hosts; //.addAll(Util.parseCommaDelimitedHosts2(hosts, port_range));
gossip_router_hosts=hosts;
return this;
}

Expand Down Expand Up @@ -180,6 +180,10 @@ public void init() throws Exception {
super.init();
if(timer == null)
throw new Exception("timer cannot be retrieved from protocol stack");
if(port_range > 0) {
log.warn("%s: port_range=%d; setting it to 0 (https://issues.redhat.com/browse/JGRP-2806)", local_addr, port_range);
port_range=0; // https://issues.redhat.com/browse/JGRP-2806
}
gossip_routers.clear();
gossip_routers.addAll(Util.parseCommaDelimitedHosts2(gossip_router_hosts, port_range));
if(gossip_routers.isEmpty())
Expand Down
11 changes: 7 additions & 4 deletions src/org/jgroups/stack/RouterStub.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.*;
import java.util.concurrent.TimeUnit;

import static java.lang.System.currentTimeMillis;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static org.jgroups.util.Util.printTime;


/**
Expand Down Expand Up @@ -132,7 +135,7 @@ public void connect(String group, Address addr, String logical_name, PhysicalAdd
_doConnect();
}
if(handle_heartbeats)
last_heartbeat=System.currentTimeMillis();
last_heartbeat=currentTimeMillis();
try {
writeRequest(new GossipData(GossipType.REGISTER, group, addr, logical_name, phys_addr));
}
Expand Down Expand Up @@ -231,7 +234,7 @@ public void receive(Address sender, DataInput in, int length) {
break;
}
if(handle_heartbeats)
last_heartbeat=System.currentTimeMillis();
last_heartbeat=currentTimeMillis();
} catch(Exception ex) {
log.error(Util.getMessage("FailedReadingData"), ex);
}
Expand Down Expand Up @@ -262,7 +265,7 @@ public String toString() {
return String.format("RouterStub[local=%s, router_host=%s %s] - age: %s",
client != null? client.localAddress() : "n/a", remote,
isConnected()? "connected" : "disconnected",
Util.printTime(System.currentTimeMillis()-last_heartbeat, TimeUnit.MILLISECONDS));
isConnected()? printTime(currentTimeMillis()-last_heartbeat, MILLISECONDS) : "n/a");
}

/** Creates remote from remote_sa. If the latter is unresolved, tries to resolve it one more time (e.g. via DNS) */
Expand Down

0 comments on commit b3ad28c

Please sign in to comment.