Skip to content

Commit

Permalink
fix NPE, print warning to log file instead
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed Jul 15, 2017
1 parent abe9b73 commit a7cf9e0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lbms/plugins/mldht/kad/DHT.java
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,13 @@ public void start (DHTConfiguration config)
// initialize as many RPC servers as we need
serverManager.refresh(System.currentTimeMillis());

if(serverManager.getServerCount() == 0) {
logError("No network interfaces eligible for DHT sockets found during startup."
+ "\nAddress family: " + this.getType()
+ "\nmultihoming [requires public IP addresses if enabled]: " + config.allowMultiHoming()
+ "\nPublic IP addresses: " + AddressUtils.getAvailableGloballyRoutableAddrs(getType().PREFERRED_ADDRESS_TYPE)
+ "\nDefault route: " + AddressUtils.getDefaultRoute(getType().PREFERRED_ADDRESS_TYPE));
}

started();

Expand Down Expand Up @@ -1015,6 +1022,9 @@ void routerBootstrap() {
CompletableFuture<RPCCall> f = new CompletableFuture<>();

RPCServer srv = serverManager.getRandomActiveServer(true);
if(srv == null)
continue;

c.addListener(new RPCCallListener() {
@Override
public void stateTransition(RPCCall c, RPCState previous, RPCState current) {
Expand Down

0 comments on commit a7cf9e0

Please sign in to comment.