Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2014-08-07 05:54:00 -0400
committerUwe Stieber2014-08-07 05:54:00 -0400
commit4308b80346803ccdc366341ac158f081fce765ab (patch)
tree9087383621875b1020c0478230650bbe0461313b
parent11b1dfdefde1d24321e2f15e0162d2ed4102b8de (diff)
downloadorg.eclipse.tcf-4308b80346803ccdc366341ac158f081fce765ab.tar.gz
org.eclipse.tcf-4308b80346803ccdc366341ac158f081fce765ab.tar.xz
org.eclipse.tcf-4308b80346803ccdc366341ac158f081fce765ab.zip
Target Explorer: Close channel step group initialized with wrong peer context
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java
index 4182a9019..deda18f44 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/ChannelManager.java
@@ -65,6 +65,8 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
/* default */ final Map<String, StepperJob> pendingOpenChannel = new HashMap<String, StepperJob>();
// The map of scheduled "close channel" stepper jobs per channel
/* default */ final Map<IChannel, StepperJob> pendingCloseChannel = new HashMap<IChannel, StepperJob>();
+ // The map of channel to peer associations
+ /* default */ final Map<IChannel, IPeer> c2p = new HashMap<IChannel, IPeer>();
/**
* Constructor
@@ -173,6 +175,7 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
// Channel is not in open state -> drop the instance
channels.remove(id);
refCounters.remove(channel);
+ c2p.remove(channel);
channel = null;
}
}
@@ -236,6 +239,9 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
if (finForceNew) forcedChannels.add(channel);
if (finForceNew) forcedChannelFlags.put(channel, flags);
+ // Remember for which peer the channel got opened.
+ c2p.put(channel, peer);
+
// Job is done -> remove it from the list of pending jobs (shared channels only)
if (!finForceNew) pendingOpenChannel.remove(id);
@@ -339,6 +345,7 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
// Channel is not in open state -> drop the instance
channels.remove(id);
refCounters.remove(channel);
+ c2p.remove(channel);
channel = null;
}
@@ -375,8 +382,11 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
Assert.isNotNull(channel);
Assert.isTrue(Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
+ // Determine the peer for the channel to close
+ IPeer p = c2p.get(channel);
+ final IPeer peer = p != null ? p : channel.getRemotePeer();
+
// Get the id of the remote peer
- final IPeer peer = channel.getRemotePeer();
final String id = peer.getID();
if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_CHANNEL_MANAGER)) {
@@ -461,6 +471,9 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
if (!isRefCounted) forcedChannels.remove(channel);
if (!isRefCounted) forcedChannelFlags.remove(channel);
+ // Remove the channel / peer association
+ c2p.remove(channel);
+
if (CoreBundleActivator.getTraceHandler().isSlotEnabled(0, ITraceIds.TRACE_CHANNEL_MANAGER)) {
CoreBundleActivator.getTraceHandler().trace(NLS.bind(Messages.ChannelManager_closeChannel_closed_message, id),
0, ITraceIds.TRACE_CHANNEL_MANAGER, IStatus.INFO, ChannelManager.this);
@@ -540,6 +553,7 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
if (c.getState() == IChannel.STATE_CLOSED) {
iter.remove();
forcedChannelFlags.remove(c);
+ c2p.remove(c);
}
}
}
@@ -629,6 +643,8 @@ public class ChannelManager extends PlatformObject implements IChannelManager {
channels.clear();
for (IChannel channel : openChannels) internalCloseChannel(channel);
+
+ c2p.clear();
}
// ----- Streams handling -----

Back to the top