PR #11402 - move methods to original position in WebSocketConnection

Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
Lachlan Roberts 2024-02-23 11:18:17 +11:00
parent 436f4f8507
commit 4ca044486e
1 changed files with 34 additions and 34 deletions

View File

@ -199,40 +199,6 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
this.useOutputDirectByteBuffers = useOutputDirectByteBuffers;
}
/**
* Extra bytes from the initial HTTP upgrade that need to
* be processed by the websocket parser before starting
* to read bytes from the connection
*
* @param initialBuffer the bytes of extra content encountered during upgrade
*/
protected void setInitialBuffer(ByteBuffer initialBuffer)
{
if (LOG.isDebugEnabled())
LOG.debug("Set initial buffer - {}", BufferUtil.toDetailString(initialBuffer));
try (AutoLock l = lock.lock())
{
networkBuffer = newNetworkBuffer(initialBuffer.remaining());
}
ByteBuffer buffer = networkBuffer.getByteBuffer();
BufferUtil.clearToFill(buffer);
BufferUtil.put(initialBuffer, buffer);
BufferUtil.flipToFlush(buffer, 0);
}
@Override
public void onOpen()
{
if (LOG.isDebugEnabled())
LOG.debug("onOpen() {}", this);
// Open Session
super.onOpen();
coreSession.onOpen();
if (moreDemand())
fillAndParse();
}
@Override
public void onClose(Throwable cause)
{
@ -533,6 +499,40 @@ public class WebSocketConnection extends AbstractConnection implements Connectio
}
}
/**
* Extra bytes from the initial HTTP upgrade that need to
* be processed by the websocket parser before starting
* to read bytes from the connection
*
* @param initialBuffer the bytes of extra content encountered during upgrade
*/
protected void setInitialBuffer(ByteBuffer initialBuffer)
{
if (LOG.isDebugEnabled())
LOG.debug("Set initial buffer - {}", BufferUtil.toDetailString(initialBuffer));
try (AutoLock l = lock.lock())
{
networkBuffer = newNetworkBuffer(initialBuffer.remaining());
}
ByteBuffer buffer = networkBuffer.getByteBuffer();
BufferUtil.clearToFill(buffer);
BufferUtil.put(initialBuffer, buffer);
BufferUtil.flipToFlush(buffer, 0);
}
@Override
public void onOpen()
{
if (LOG.isDebugEnabled())
LOG.debug("onOpen() {}", this);
// Open Session
super.onOpen();
coreSession.onOpen();
if (moreDemand())
fillAndParse();
}
@Override
public void setInputBufferSize(int inputBufferSize)
{