Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JGRP-2837 close connection without sending fail acks #842

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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