Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2018-05-27 09:30:50 +0000
committerEike Stepper2018-05-27 09:30:50 +0000
commitad54bdbd490bf43fa1cdabf4b4a0e1c6934deb8c (patch)
tree668436b90b9590b2d687ddeca1e2ba303c970068 /plugins/org.eclipse.net4j.tcp
parentbaa83a0936ece0e0edbd705fdf41b9b06b5555db (diff)
downloadcdo-ad54bdbd490bf43fa1cdabf4b4a0e1c6934deb8c.tar.gz
cdo-ad54bdbd490bf43fa1cdabf4b4a0e1c6934deb8c.tar.xz
cdo-ad54bdbd490bf43fa1cdabf4b4a0e1c6934deb8c.zip
[535161] Implement a buffer tracer
https://bugs.eclipse.org/bugs/show_bug.cgi?id=535161
Diffstat (limited to 'plugins/org.eclipse.net4j.tcp')
-rw-r--r--plugins/org.eclipse.net4j.tcp/.settings/.api_filters208
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java17
-rw-r--r--plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ssl/SSLBuffer.java35
3 files changed, 232 insertions, 28 deletions
diff --git a/plugins/org.eclipse.net4j.tcp/.settings/.api_filters b/plugins/org.eclipse.net4j.tcp/.settings/.api_filters
new file mode 100644
index 0000000000..1cc951e636
--- /dev/null
+++ b/plugins/org.eclipse.net4j.tcp/.settings/.api_filters
@@ -0,0 +1,208 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<component id="org.eclipse.net4j.tcp" version="2">
+ <resource path="src/org/eclipse/net4j/internal/tcp/ControlChannel.java">
+ <filter id="0"/>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/ControlChannel.java" type="org.eclipse.net4j.internal.tcp.ControlChannel">
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="TCPConnector"/>
+ <message_argument value="ControlChannel"/>
+ <message_argument value="getConnector()"/>
+ </message_arguments>
+ </filter>
+ <filter id="643850349">
+ <message_arguments>
+ <message_argument value="TCPConnector"/>
+ <message_argument value="ControlChannel"/>
+ <message_argument value="ControlChannel(TCPConnector)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java">
+ <filter id="0"/>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPAcceptor.java" type="org.eclipse.net4j.internal.tcp.TCPAcceptor">
+ <filter id="574619656">
+ <message_arguments>
+ <message_argument value="ITCPAcceptor"/>
+ <message_argument value="TCPAcceptor"/>
+ </message_arguments>
+ </filter>
+ <filter id="574619656">
+ <message_arguments>
+ <message_argument value="ITCPPassiveSelectorListener"/>
+ <message_argument value="TCPAcceptor"/>
+ </message_arguments>
+ </filter>
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="TCPSelector"/>
+ <message_argument value="TCPAcceptor"/>
+ <message_argument value="getSelector()"/>
+ </message_arguments>
+ </filter>
+ <filter id="643846161">
+ <message_arguments>
+ <message_argument value="TCPSelector"/>
+ <message_argument value="TCPAcceptor"/>
+ <message_argument value="setSelector(TCPSelector)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPAcceptorFactory.java">
+ <filter id="0"/>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPAcceptorFactory.java" type="org.eclipse.net4j.internal.tcp.TCPAcceptorFactory">
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="TCPAcceptor"/>
+ <message_argument value="TCPAcceptorFactory"/>
+ <message_argument value="create(String)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPConnector.java">
+ <filter id="0"/>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPConnector.java" type="org.eclipse.net4j.internal.tcp.TCPConnector">
+ <filter id="574619656">
+ <message_arguments>
+ <message_argument value="ITCPActiveSelectorListener"/>
+ <message_argument value="TCPConnector"/>
+ </message_arguments>
+ </filter>
+ <filter id="574619656">
+ <message_arguments>
+ <message_argument value="ITCPConnector"/>
+ <message_argument value="TCPConnector"/>
+ </message_arguments>
+ </filter>
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="ControlChannel"/>
+ <message_argument value="TCPConnector"/>
+ <message_argument value="getControlChannel()"/>
+ </message_arguments>
+ </filter>
+ <filter id="643846161">
+ <message_arguments>
+ <message_argument value="ControlChannel"/>
+ <message_argument value="TCPConnector"/>
+ <message_argument value="setControlChannel(ControlChannel)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPConnector.java" type="org.eclipse.net4j.internal.tcp.TCPConnector$TCPNegotiationContext">
+ <filter id="574619656">
+ <message_arguments>
+ <message_argument value="ITCPNegotiationContext"/>
+ <message_argument value="TCPNegotiationContext"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPConnectorFactory.java">
+ <filter id="0"/>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPConnectorFactory.java" type="org.eclipse.net4j.internal.tcp.TCPConnectorFactory">
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="TCPConnector"/>
+ <message_argument value="TCPConnectorFactory"/>
+ <message_argument value="create(String)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPSelector.java">
+ <filter id="0"/>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPSelector.java" type="org.eclipse.net4j.internal.tcp.TCPSelector">
+ <filter id="574619656">
+ <message_arguments>
+ <message_argument value="ITCPSelector"/>
+ <message_argument value="TCPSelector"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPSelectorFactory.java">
+ <filter id="0"/>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPSelectorFactory.java" type="org.eclipse.net4j.internal.tcp.TCPSelectorFactory">
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="TCPSelector"/>
+ <message_argument value="TCPSelectorFactory"/>
+ <message_argument value="create(String)"/>
+ </message_arguments>
+ </filter>
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="TCPSelector"/>
+ <message_argument value="TCPSelectorFactory"/>
+ <message_argument value="get(IManagedContainer, String)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPServerConnector.java">
+ <filter id="0"/>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/TCPServerConnector.java" type="org.eclipse.net4j.internal.tcp.TCPServerConnector">
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="TCPAcceptor"/>
+ <message_argument value="TCPServerConnector"/>
+ <message_argument value="getAcceptor()"/>
+ </message_arguments>
+ </filter>
+ <filter id="643850349">
+ <message_arguments>
+ <message_argument value="TCPAcceptor"/>
+ <message_argument value="TCPServerConnector"/>
+ <message_argument value="TCPServerConnector(TCPAcceptor)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/ssl/SSLBuffer.java">
+ <filter id="0"/>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/ssl/SSLBuffer.java" type="org.eclipse.net4j.internal.tcp.ssl.SSLBuffer">
+ <filter id="643850349">
+ <message_arguments>
+ <message_argument value="SSLEngineManager"/>
+ <message_argument value="SSLBuffer"/>
+ <message_argument value="SSLBuffer(IBufferProvider, short, SSLEngineManager)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/ssl/SSLBufferFactory.java">
+ <filter id="0"/>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/ssl/SSLBufferFactory.java" type="org.eclipse.net4j.internal.tcp.ssl.SSLBufferFactory">
+ <filter id="643850349">
+ <message_arguments>
+ <message_argument value="SSLEngineManager"/>
+ <message_argument value="SSLBufferFactory"/>
+ <message_argument value="SSLBufferFactory(SSLEngineManager)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/ssl/SSLServerConnector.java">
+ <filter id="0"/>
+ </resource>
+ <resource path="src/org/eclipse/net4j/internal/tcp/ssl/SSLServerConnector.java" type="org.eclipse.net4j.internal.tcp.ssl.SSLServerConnector">
+ <filter id="643842064">
+ <message_arguments>
+ <message_argument value="SSLAcceptor"/>
+ <message_argument value="SSLServerConnector"/>
+ <message_argument value="getAcceptor()"/>
+ </message_arguments>
+ </filter>
+ <filter id="643850349">
+ <message_arguments>
+ <message_argument value="SSLAcceptor"/>
+ <message_argument value="SSLServerConnector"/>
+ <message_argument value="SSLServerConnector(SSLAcceptor)"/>
+ </message_arguments>
+ </filter>
+ </resource>
+</component>
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
index 2080ed5b27..9977734168 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ControlChannel.java
@@ -128,8 +128,7 @@ public class ControlChannel extends Channel
{
try
{
- ByteBuffer byteBuffer = buffer.getByteBuffer();
- byte opcode = byteBuffer.get();
+ byte opcode = buffer.get();
switch (opcode)
{
case OPCODE_NEGOTIATION:
@@ -143,7 +142,7 @@ public class ControlChannel extends Channel
}
Receiver receiver = negotiationContext.getReceiver();
- receiver.receiveBuffer(negotiationContext, byteBuffer);
+ receiver.receiveBuffer(negotiationContext, buffer.getByteBuffer());
break;
}
@@ -155,14 +154,14 @@ public class ControlChannel extends Channel
case OPCODE_REGISTRATION_VERSIONED:
{
assertConnected();
- short channelID = byteBuffer.getShort();
+ short channelID = buffer.getShort();
assertValidChannelID(channelID);
String error = null;
try
{
- int protocolVersion = byteBuffer.getInt();
- String protocolID = BufferUtil.getString(byteBuffer);
+ int protocolVersion = buffer.getInt();
+ String protocolID = buffer.getString();
InternalChannel channel = getConnector().inverseOpenChannel(channelID, protocolID, protocolVersion);
if (channel == null)
@@ -186,7 +185,7 @@ public class ControlChannel extends Channel
case OPCODE_DEREGISTRATION:
{
assertConnected();
- short channelID = byteBuffer.getShort();
+ short channelID = buffer.getShort();
if (channelID == CONTROL_CHANNEL_INDEX)
{
throw new ImplementationError();
@@ -210,8 +209,8 @@ public class ControlChannel extends Channel
case OPCODE_REGISTRATION_ACK:
{
assertConnected();
- short channelID = byteBuffer.getShort();
- String error = BufferUtil.getString(byteBuffer);
+ short channelID = buffer.getShort();
+ String error = buffer.getString();
if (error == null)
{
error = SUCCESS;
diff --git a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ssl/SSLBuffer.java b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ssl/SSLBuffer.java
index 30e145259f..1c4cb86b8a 100644
--- a/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ssl/SSLBuffer.java
+++ b/plugins/org.eclipse.net4j.tcp/src/org/eclipse/net4j/internal/tcp/ssl/SSLBuffer.java
@@ -71,18 +71,16 @@ public class SSLBuffer extends Buffer
buf.flip();
int limit = buf.limit();
- ByteBuffer byteBuffer = getByteBuffer();
-
- int capacity = byteBuffer.capacity();
+ int capacity = getCapacity();
limit = limit > capacity ? capacity : limit;
- byteBuffer.put(buf.array(), 0, limit);
+ put(buf.array(), 0, limit);
buf.position(limit);
buf.compact();
- byteBuffer.flip();
+ flip();
- setChannelID(byteBuffer.getShort());
- short payloadSize = byteBuffer.getShort();
+ setChannelID(getShort());
+ short payloadSize = getShort();
if (payloadSize < 0)
{
@@ -92,17 +90,17 @@ public class SSLBuffer extends Buffer
payloadSize -= MAKE_PAYLOAD_SIZE_NON_ZERO;
- byteBuffer.position(IBuffer.HEADER_SIZE);
+ setPosition(IBuffer.HEADER_SIZE);
setState(BufferState.READING_HEADER);
- byteBuffer.compact();
- byteBuffer.limit(payloadSize);
+ compact();
+ setLimit(payloadSize);
setState(BufferState.READING_BODY);
- byteBuffer.flip();
+ flip();
setState(BufferState.GETTING);
- return byteBuffer;
+ return getByteBuffer();
}
else if (readSize < 0)
{
@@ -141,7 +139,6 @@ public class SSLBuffer extends Buffer
throw new IllegalStateException(toString());
}
- ByteBuffer byteBuffer = getByteBuffer();
if (state == BufferState.PUTTING)
{
if (getChannelID() == NO_CHANNEL)
@@ -149,7 +146,7 @@ public class SSLBuffer extends Buffer
throw new IllegalStateException("channelID == NO_CHANNEL"); //$NON-NLS-1$
}
- int payloadSize = byteBuffer.position() - IBuffer.HEADER_SIZE + MAKE_PAYLOAD_SIZE_NON_ZERO;
+ int payloadSize = getPosition() - IBuffer.HEADER_SIZE + MAKE_PAYLOAD_SIZE_NON_ZERO;
if (isEOS())
{
payloadSize = -payloadSize;
@@ -161,14 +158,14 @@ public class SSLBuffer extends Buffer
+ (isEOS() ? " (EOS)" : "") + StringUtil.NL + formatContent(false)); //$NON-NLS-1$ //$NON-NLS-2$
}
- byteBuffer.flip();
- byteBuffer.putShort(getChannelID());
- byteBuffer.putShort((short)payloadSize);
- byteBuffer.position(0);
+ flip();
+ putShort(getChannelID());
+ putShort((short)payloadSize);
+ setPosition(0);
setState(BufferState.WRITING);
}
- sslEngineManager.getAppSendBuf().put(byteBuffer);
+ sslEngineManager.getAppSendBuf().put(getByteBuffer());
sslEngineManager.write(socketChannel);
if (sslEngineManager.getPacketSendBuf().position() > 0)

Back to the top