cache: don't complete haneshake future until after state is changed to connected

This commit is contained in:
Adam
2017-07-18 20:48:05 -04:00
parent 45e41e06d6
commit 5a270cfc6d

View File

@@ -134,10 +134,9 @@ public class CacheClient implements AutoCloseable
{ {
assert handshakeFuture != null; assert handshakeFuture != null;
handshakeFuture.complete(response);
if (response != HelloHandshake.RESPONSE_OK) if (response != HelloHandshake.RESPONSE_OK)
{ {
handshakeFuture.complete(response);
close(); close();
return; return;
} }
@@ -153,6 +152,8 @@ public class CacheClient implements AutoCloseable
state = ClientState.CONNECTED; state = ClientState.CONNECTED;
logger.info("Client is now connected!"); logger.info("Client is now connected!");
handshakeFuture.complete(response);
} }
@Override @Override