diff options
author | Eike Stepper | 2008-09-28 10:46:26 +0000 |
---|---|---|
committer | Eike Stepper | 2008-09-28 10:46:26 +0000 |
commit | f90aa3a8372cd5a10d1d7edb5ea2a60618a97ca1 (patch) | |
tree | 12b53f7b9e168fa29d71985b0bf2708bc0e6e121 /plugins/org.eclipse.net4j.http.common | |
parent | d0f8a39011921f62e4f02a4e7ceba0da34d4988b (diff) | |
download | cdo-f90aa3a8372cd5a10d1d7edb5ea2a60618a97ca1.tar.gz cdo-f90aa3a8372cd5a10d1d7edb5ea2a60618a97ca1.tar.xz cdo-f90aa3a8372cd5a10d1d7edb5ea2a60618a97ca1.zip |
[201366] Channels are messed up in remote connector
https://bugs.eclipse.org/bugs/show_bug.cgi?id=201366
Diffstat (limited to 'plugins/org.eclipse.net4j.http.common')
-rw-r--r-- | plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java | 57 |
1 files changed, 15 insertions, 42 deletions
diff --git a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java index 332624c87e..b490584879 100644 --- a/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java +++ b/plugins/org.eclipse.net4j.http.common/src/org/eclipse/net4j/http/internal/common/HTTPConnector.java @@ -183,16 +183,16 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector } @Override - protected InternalChannel createChannelInstance() + protected InternalChannel createChannel() { return new HTTPChannel(); } @Override - protected void registerChannelWithPeer(final int channelID, final short channelIndex, final IProtocol protocol, - long timeout) throws ConnectorException + protected void registerChannelWithPeer(short channelIndex, long timeout, IProtocol protocol) + throws ConnectorException { - ChannelOperation operation = new OpenChannelOperation(channelIndex, channelID, protocol.getType()); + ChannelOperation operation = new OpenChannelOperation(channelIndex, protocol.getType()); outputOperations.add(operation); HTTPChannel channel = (HTTPChannel)getChannel(channelIndex); @@ -200,21 +200,14 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector } @Override - public boolean removeChannel(IChannel channel) + protected void deregisterChannelFromPeer(InternalChannel channel, long timeout) throws ConnectorException { - if (super.removeChannel(channel)) + HTTPChannel httpChannel = (HTTPChannel)channel; + if (!httpChannel.isInverseRemoved()) { - HTTPChannel httpChannel = (HTTPChannel)channel; - if (!httpChannel.isInverseRemoved()) - { - ChannelOperation operation = new CloseChannelOperation(httpChannel); - outputOperations.add(operation); - } - - return true; + ChannelOperation operation = new CloseChannelOperation(httpChannel); + outputOperations.add(operation); } - - return false; } protected boolean pollAgain() @@ -328,21 +321,17 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector */ private final class OpenChannelOperation extends ChannelOperation { - private int channelID; - private String protocolID; - public OpenChannelOperation(short channelIndex, int channelID, String protocolID) + public OpenChannelOperation(short channelIndex, String protocolID) { super(channelIndex, 0); - this.channelID = channelID; this.protocolID = protocolID; } public OpenChannelOperation(ExtendedDataInputStream in) throws IOException { super(in); - channelID = in.readInt(); protocolID = in.readString(); } @@ -350,7 +339,6 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector public void write(ExtendedDataOutputStream out) throws IOException { super.write(out); - out.writeInt(channelID); out.writeString(protocolID); } @@ -360,11 +348,6 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector return OPERATION_OPEN; } - public int getChannelID() - { - return channelID; - } - public String getProtocolID() { return protocolID; @@ -373,10 +356,10 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector @Override public void execute() { - HTTPChannel channel = (HTTPChannel)createChannel(channelID, getChannelIndex(), protocolID); + HTTPChannel channel = (HTTPChannel)inverseOpenChannel(getChannelIndex(), protocolID); if (channel == null) { - throw new IllegalStateException("Could not open channel"); + throw new ConnectorException("Could not open channel"); } channel.increaseInputOperationCount(); @@ -386,17 +369,8 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector @Override public void doEexecute(HTTPChannel channel) { - boolean success = false; - try - { - channel.activate(); - success = true; - } - finally - { - ChannelOperation operation = new OpenAckChannelOperation(getChannelIndex(), success); - outputOperations.add(operation); - } + ChannelOperation operation = new OpenAckChannelOperation(getChannelIndex(), true); + outputOperations.add(operation); } } @@ -464,9 +438,8 @@ public abstract class HTTPConnector extends Connector implements IHTTPConnector @Override public void doEexecute(HTTPChannel channel) { - // TODO Fix protocol between Channel.close and Connector.removeChannel/inverserRemoveChannel channel.setInverseRemoved(); - inverseRemoveChannel(channel.getChannelID(), channel.getChannelIndex()); + inverseCloseChannel(channel.getChannelIndex()); } } |