Merge pull request #9624 from luvarqpp/patch-1
Fix exception when receiving POISON_PILL
This commit is contained in:
commit
26f21645a4
@ -49,12 +49,12 @@ public class EchoServer {
|
|||||||
if (new String(buffer.array()).trim().equals(POISON_PILL)) {
|
if (new String(buffer.array()).trim().equals(POISON_PILL)) {
|
||||||
client.close();
|
client.close();
|
||||||
System.out.println("Not accepting client messages anymore");
|
System.out.println("Not accepting client messages anymore");
|
||||||
}
|
} else {
|
||||||
|
|
||||||
buffer.flip();
|
buffer.flip();
|
||||||
client.write(buffer);
|
client.write(buffer);
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void register(Selector selector, ServerSocketChannel serverSocket) throws IOException {
|
private static void register(Selector selector, ServerSocketChannel serverSocket) throws IOException {
|
||||||
SocketChannel client = serverSocket.accept();
|
SocketChannel client = serverSocket.accept();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user