}
}
private void handleCPing() {
state = new AjpParseState();
final StreamConnection underlyingChannel = connection.getChannel();
underlyingChannel.getSourceChannel().suspendReads();
final ByteBuffer buffer = ByteBuffer.wrap(CPONG);
int res;
try {
do {
res = underlyingChannel.getSinkChannel().write(buffer);
if (res == 0) {
underlyingChannel.getSinkChannel().setWriteListener(new ChannelListener<ConduitStreamSinkChannel>() {
@Override
public void handleEvent(ConduitStreamSinkChannel channel) {
int res;
do {
try {
res = channel.write(buffer);
if (res == 0) {
return;
}
} catch (IOException e) {
UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
IoUtils.safeClose(connection);
}
} while (buffer.hasRemaining());
channel.suspendWrites();
AjpReadListener.this.handleEvent(underlyingChannel.getSourceChannel());
}
});
underlyingChannel.getSinkChannel().resumeWrites();
return;
}
} while (buffer.hasRemaining());
AjpReadListener.this.handleEvent(underlyingChannel.getSourceChannel());
} catch (IOException e) {
UndertowLogger.REQUEST_IO_LOGGER.ioException(e);
IoUtils.safeClose(connection);
}
}