Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2016-08-30 18:09:47 +0000
committerEugene Tarassov2016-08-30 18:09:47 +0000
commit2a334481a0f2a884231b22443527f9e018c0fc60 (patch)
treeb1b34220f419a26686eeb85e9dc5934012f908ec /plugins
parent1ec43203b70d9f95a9e3fce3bd03e366815e4ddc (diff)
downloadorg.eclipse.tcf-2a334481a0f2a884231b22443527f9e018c0fc60.tar.gz
org.eclipse.tcf-2a334481a0f2a884231b22443527f9e018c0fc60.tar.xz
org.eclipse.tcf-2a334481a0f2a884231b22443527f9e018c0fc60.zip
TCF Core: auto-discovery should not broadcast user-defined peers info
See also: Bug 500522 - DATA_RETENTION_PERIOD value very big
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/AbstractPeer.java6
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/UserDefPeer.java27
-rw-r--r--plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java23
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFUserDefPeer.java6
4 files changed, 46 insertions, 16 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/AbstractPeer.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/AbstractPeer.java
index 779acbf84..22c5cdee8 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/AbstractPeer.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/AbstractPeer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2016 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -77,9 +77,7 @@ public class AbstractPeer extends TransientPeer {
/**
* Updates Peer properties using the given attributes parameters
- *
- * @param attrs
- * attributes map with which to update the peer
+ * @param attrs - attributes map with which to update the peer
*/
public void updateAttributes(Map<String, String> attrs) {
long time = System.currentTimeMillis();
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/UserDefPeer.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/UserDefPeer.java
new file mode 100644
index 000000000..2101df66c
--- /dev/null
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/core/UserDefPeer.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2016 Xilinx, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Xilinx - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tcf.core;
+
+import java.util.Map;
+
+/**
+ * The class represents manually configured (user defined) TCF peers (targets).
+ * Unlike auto-discovered peers, manually configured ones are persistent -
+ * they exist until explicitly deleted by user.
+ *
+ * User defined peers info is not broadcasted over TCF discovery protocol.
+ */
+public class UserDefPeer extends AbstractPeer {
+
+ public UserDefPeer(Map<String, String> attrs) {
+ super(attrs);
+ }
+}
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
index a6b7a2720..bc267f79a 100644
--- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
+++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/local/LocatorService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2016 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,6 +38,7 @@ import org.eclipse.tcf.internal.core.LoggingUtil;
import org.eclipse.tcf.internal.core.RemotePeer;
import org.eclipse.tcf.internal.core.ServiceManager;
import org.eclipse.tcf.core.AbstractChannel;
+import org.eclipse.tcf.core.UserDefPeer;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IErrorReport;
import org.eclipse.tcf.protocol.IPeer;
@@ -1019,9 +1020,10 @@ public class LocatorService implements ILocator {
}
/**
- * Sends a Peer Request to the given Address and Port on all subnets
- * @param addr IP Address of the Peer
- * @param port Port number of the Peer
+ * Sends a Peer Request to the given address and port.
+ * If address is null, broadcast on all subnets.
+ * @param addr - IP address to send the request, or null
+ * @param port - IP port number to send the request
*/
private void sendPeersRequest(InetAddress addr, int port) {
out_buf[4] = CONF_REQ_INFO;
@@ -1031,12 +1033,14 @@ public class LocatorService implements ILocator {
}
/**
- *
- * @param peer
- * @param addr
- * @param port
+ * Send peer info to the given address and port.
+ * If address is null, broadcast on all subnets.
+ * @param peer - a peer info to send
+ * @param addr - IP address to send the info, or null
+ * @param port - IP port number to send the info
*/
private void sendPeerInfo(IPeer peer, InetAddress addr, int port) {
+ if (peer instanceof UserDefPeer) return;
Map<String,String> attrs = peer.getAttributes();
InetAddress peer_addr = getInetAddress(attrs.get(IPeer.ATTR_IP_HOST));
if (peer_addr == null) return;
@@ -1183,7 +1187,8 @@ public class LocatorService implements ILocator {
/**
* Handles packets received during the auto discovery.
- * It verifies the packet is indeed a TCF packet, and handles it depending on the auto-configuration command and responses codes e.g: CONF_PEER_INFO,
+ * It verifies the packet is indeed a TCF packet, and handles it depending on the auto-configuration command
+ * and responses codes e.g: CONF_PEER_INFO,
* CONF_REQ_INFO, etc..
*
* @param p packet received
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFUserDefPeer.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFUserDefPeer.java
index 27b77591e..85f8c8213 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFUserDefPeer.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFUserDefPeer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007, 2016 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,7 +22,7 @@ import java.util.Map;
import org.eclipse.core.runtime.IPath;
import org.eclipse.tcf.internal.debug.Activator;
-import org.eclipse.tcf.core.AbstractPeer;
+import org.eclipse.tcf.core.UserDefPeer;
import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.Protocol;
@@ -32,7 +32,7 @@ import org.eclipse.tcf.protocol.Protocol;
* they exist until explicitly deleted by user.
* Eclipse plug-in state storage is used to keep the configuration data.
*/
-public class TCFUserDefPeer extends AbstractPeer {
+public class TCFUserDefPeer extends UserDefPeer {
public TCFUserDefPeer(Map<String, String> attrs) {
super(attrs);

Back to the top