Skip to content

Commit

Permalink
Removed FAIL when use_acks is true; not needed as connection is close…
Browse files Browse the repository at this point in the history
…d anyway
  • Loading branch information
belaban committed Oct 3, 2024
1 parent 67969f6 commit dd3821d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 7 deletions.
1 change: 0 additions & 1 deletion src/org/jgroups/blocks/cs/BaseServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ public abstract class BaseServer implements Closeable, ConnectionListener {
protected int linger=-1;
protected TimeService time_service;
public static final byte[] OK={1,2,3,4}; // ack (srv->client) on successful connection establishment
public static final byte[] FAIL={4,3,2,1}; // ack (srv->client) on failed connection establishment



Expand Down
2 changes: 0 additions & 2 deletions src/org/jgroups/blocks/cs/TcpConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ protected void connect(Address dest, boolean send_local_addr, boolean use_acks)
in.readFully(ack, 0, ack.length);
if(Arrays.equals(BaseServer.OK, ack))
;
else if(Arrays.equals(BaseServer.FAIL, ack))
throw new IllegalStateException("received FAIL from peer");
else
server.log().error("%s: received invalid ACK: %s", localAddress(), Arrays.toString(ack));
}
Expand Down
5 changes: 1 addition & 4 deletions src/org/jgroups/blocks/cs/TcpServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,7 @@ protected void handleAccept(final Socket client_sock) throws Exception {
}
else {
log.trace("%s: rejected connection from %s %s", local_addr, peer_addr, explanation(conn_exists, replace));
if(use_acks)
conn.send(FAIL, 0, FAIL.length);
conn.flush();
Util.close(conn); // keep our existing conn, reject accept() and close client_sock
Util.close(conn); // keep our existing conn and close client_sock
}
}
catch(Exception ex) {
Expand Down

0 comments on commit dd3821d

Please sign in to comment.