Skip to content

Commit

Permalink
- Waiting for acceptor thread to close server socket in NioServer bef…
Browse files Browse the repository at this point in the history
…ore returning (https://issues.redhat.com/browse/JGRP-2647)

- Changed semantics of FD_SOCK2.port_range: 0 means test *1* port. This aligns the semantics with those of other protocols, e.g. FD_SOCK
  • Loading branch information
belaban committed Oct 17, 2022
1 parent 82483e7 commit ad0693a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/org/jgroups/blocks/cs/NioServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public synchronized void stop() {
// Util.close(selector); // closing the selector also stops the acceptor thread
// socket_factory.close(channel);
selector.wakeup();
// Wait for server channel to close (via acceptorDone())
Util.interruptAndWaitToDie(acceptor);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/org/jgroups/protocols/FD_SOCK2.java
Original file line number Diff line number Diff line change
Expand Up @@ -450,8 +450,8 @@ public static ByteArray messageToBuffer(Message msg) throws Exception {
}

protected int[] computeBindPorts(int actual_port) {
int[] bind_ports=new int[port_range];
for(int i=0; i < port_range; i++) {
int[] bind_ports=new int[port_range+1];
for(int i=0; i <= port_range; i++) {
int port=(actual_port+offset+i) % max_port;
if(port < min_port)
port=port+min_port;
Expand Down

0 comments on commit ad0693a

Please sign in to comment.