Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Possible logic error in ClientCnxnSocketNIO

$
0
0
Hi,
When SASL authentication is enabled, the ZooKeeper client will finally call ClientCnxnSocketNIO#sendPacket(Packet p) to send a packet to server:
@Override
void sendPacket(Packet p) throws IOException {
SocketChannel sock = (SocketChannel) sockKey.channel();
if (sock == null) {
throw new IOException("Socket is null!");

p.createBB();
ByteBuffer pbb = p.bb;
sock.write(pbb);

One problem I can see is that the sock is non-blocking, so when the sock's output buffer is full(theoretically), only part of the Packet is sent out and the communication will break.

Thanks,
- Robin

Viewing all articles
Browse latest Browse all 5648

Trending Articles