private class ProxyConnectionFactory.ProxyV2ConnectionFactory.ProxyProtocolV2Connection extends AbstractConnection implements Connection.UpgradeFrom, Connection.UpgradeTo
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
Modifier and Type | Field and Description |
---|---|
private java.nio.ByteBuffer |
_buffer |
private Connector |
_connector |
private ProxyConnectionFactory.ProxyV2ConnectionFactory.Family |
_family |
private boolean |
_headerParsed |
private int |
_length |
private boolean |
_local |
private ConnectionFactory |
_next |
private static int |
HEADER_LENGTH |
Modifier | Constructor and Description |
---|---|
protected |
ProxyProtocolV2Connection(EndPoint endp,
Connector connector,
ConnectionFactory next) |
Modifier and Type | Method and Description |
---|---|
void |
onFillable()
Callback method invoked when the endpoint is ready to be read.
|
void |
onOpen()
Callback method invoked when this connection is opened.
|
java.nio.ByteBuffer |
onUpgradeFrom()
Takes the input buffer from the connection on upgrade.
|
void |
onUpgradeTo(java.nio.ByteBuffer prefilled)
Callback method invoked when this connection is upgraded.
|
private void |
parseBodyAndUpgrade() |
private void |
parseHeader() |
private void |
releaseAndClose() |
addListener, close, failedCallback, fillInterested, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, getMessagesIn, getMessagesOut, isFillInterested, onClose, onFillInterestedFailed, onIdleExpired, onReadTimeout, removeListener, setInputBufferSize, toConnectionString, toString, tryFillInterested, tryFillInterested
private static final int HEADER_LENGTH
private final Connector _connector
private final ConnectionFactory _next
private final java.nio.ByteBuffer _buffer
private boolean _local
private ProxyConnectionFactory.ProxyV2ConnectionFactory.Family _family
private int _length
private boolean _headerParsed
protected ProxyProtocolV2Connection(EndPoint endp, Connector connector, ConnectionFactory next)
public void onUpgradeTo(java.nio.ByteBuffer prefilled)
Connection.UpgradeTo
Callback method invoked when this connection is upgraded.
This must be called before Connection.onOpen()
.
onUpgradeTo
in interface Connection.UpgradeTo
prefilled
- An optional buffer that can contain prefilled data. Typically this
results from an upgrade of one protocol to the other where the old connection has buffered
data destined for the new connection. The new connection must take ownership of the buffer
and is responsible for returning it to the buffer poolpublic void onOpen()
Connection
Callback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
onOpen
in interface Connection
onOpen
in class AbstractConnection
public void onFillable()
AbstractConnection
Callback method invoked when the endpoint is ready to be read.
onFillable
in class AbstractConnection
AbstractConnection.fillInterested()
public java.nio.ByteBuffer onUpgradeFrom()
Connection.UpgradeFrom
Takes the input buffer from the connection on upgrade.
This method is used to take any unconsumed input from a connection during an upgrade.
onUpgradeFrom
in interface Connection.UpgradeFrom
private void parseBodyAndUpgrade() throws java.io.IOException
java.io.IOException
private void parseHeader() throws java.io.IOException
java.io.IOException
private void releaseAndClose()