Merge pull request #13812 from ulisseslima/bael-322-quickfix_echo-server
BAEL-322 - quick fix - echo server loop
This commit is contained in:
commit
e819357f00
@ -45,8 +45,9 @@ public class EchoServer {
|
||||
|
||||
private static void answerWithEcho(ByteBuffer buffer, SelectionKey key) throws IOException {
|
||||
SocketChannel client = (SocketChannel) key.channel();
|
||||
client.read(buffer);
|
||||
if (new String(buffer.array()).trim().equals(POISON_PILL)) {
|
||||
int r = client.read(buffer);
|
||||
if (r == -1 || new String(buffer.array()).trim()
|
||||
.equals(POISON_PILL)) {
|
||||
client.close();
|
||||
System.out.println("Not accepting client messages anymore");
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user