Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 110435 Details for
Bug 244678
[jSLP] update to 1.0.0.RC5
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
RC4 to RC5
clipboard.txt (text/plain), 12.87 KB, created by
Markus Kuppe
on 2008-08-20 07:20:39 EDT
(
hide
)
Description:
RC4 to RC5
Filename:
MIME Type:
Creator:
Markus Kuppe
Created:
2008-08-20 07:20:39 EDT
Size:
12.87 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P ch.ethz.iks.slp >Index: source-bundle/ch/ethz/iks/slp/impl/Activator.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.orbit/ch.ethz.iks.slp/source-bundle/ch/ethz/iks/slp/impl/Attic/Activator.java,v >retrieving revision 1.1.2.2 >diff -u -r1.1.2.2 Activator.java >--- source-bundle/ch/ethz/iks/slp/impl/Activator.java 9 Jun 2008 15:22:31 -0000 1.1.2.2 >+++ source-bundle/ch/ethz/iks/slp/impl/Activator.java 20 Aug 2008 11:20:01 -0000 >@@ -48,13 +48,14 @@ > */ > public void start(final BundleContext context) throws Exception { > >- // initialize the platform abstraction layer >+ // create the platform abstraction layer but do not initialize!!! > SLPCore.platform = new OSGiPlatformAbstraction(context); >- SLPCore.init(); > > // register the service factories so each consumer gets its own Locator/Activator instance > context.registerService("ch.ethz.iks.slp.Advertiser", new ServiceFactory() { > public Object getService(Bundle bundle, ServiceRegistration registration) { >+ SLPCore.init(); >+ SLPCore.initMulticastSocket(); > return new AdvertiserImpl(); > } > public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) { >@@ -62,6 +63,7 @@ > }, null); > context.registerService("ch.ethz.iks.slp.Locator", new ServiceFactory() { > public Object getService(Bundle bundle, ServiceRegistration registration) { >+ SLPCore.init(); > return new LocatorImpl(); > } > public void ungetService(Bundle bundle, ServiceRegistration registration, Object service) { >Index: source-bundle/ch/ethz/iks/slp/impl/SLPConfiguration.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.orbit/ch.ethz.iks.slp/source-bundle/ch/ethz/iks/slp/impl/Attic/SLPConfiguration.java,v >retrieving revision 1.1.2.2 >diff -u -r1.1.2.2 SLPConfiguration.java >--- source-bundle/ch/ethz/iks/slp/impl/SLPConfiguration.java 9 Jun 2008 15:22:31 -0000 1.1.2.2 >+++ source-bundle/ch/ethz/iks/slp/impl/SLPConfiguration.java 20 Aug 2008 11:20:01 -0000 >@@ -129,8 +129,6 @@ > > private static final String CONVERGENCE_FAILERCOUNT_PROP = "net.slp.failercount"; > >- private static final String UA_ONLY_PROP = "net.slp.uaonly"; >- > private static final String DEBUG_ENABLED_PROP = "ch.ethz.iks.slp.debug"; > > private static String[] INTERFACES; >@@ -175,8 +173,6 @@ > > private static int CONVERGENCE_FAILERCOUNT; > >- private static boolean UA_ONLY; >- > private static boolean DEBUG_ENABLED; > > /** >@@ -262,9 +258,6 @@ > > CONVERGENCE_FAILERCOUNT = Integer.parseInt(props.getProperty(CONVERGENCE_FAILERCOUNT_PROP, DEFAULT_CONVERGENCE_FAILERCOUNT)); > >- UA_ONLY = new Boolean(props.getProperty(UA_ONLY_PROP, >- "false")).booleanValue(); >- > DEBUG_ENABLED = new Boolean(props.getProperty(DEBUG_ENABLED_PROP, > "false")).booleanValue(); > >@@ -519,13 +512,6 @@ > int getConvergenceFailerCount() { > return CONVERGENCE_FAILERCOUNT; > } >- >- /** >- * @return >- */ >- public boolean isUAOnly() { >- return UA_ONLY; >- } > > public boolean getDebugEnabled() { > return DEBUG_ENABLED; >Index: source-bundle/ch/ethz/iks/slp/impl/OSGiPlatformAbstraction.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.orbit/ch.ethz.iks.slp/source-bundle/ch/ethz/iks/slp/impl/Attic/OSGiPlatformAbstraction.java,v >retrieving revision 1.1.2.2 >diff -u -r1.1.2.2 OSGiPlatformAbstraction.java >--- source-bundle/ch/ethz/iks/slp/impl/OSGiPlatformAbstraction.java 9 Jun 2008 15:22:31 -0000 1.1.2.2 >+++ source-bundle/ch/ethz/iks/slp/impl/OSGiPlatformAbstraction.java 20 Aug 2008 11:20:01 -0000 >@@ -80,9 +80,6 @@ > this.log = (LogService) context.getService(sref); > } > >- // debug? >- logWarning("DEBUG OUTPUT: " + Boolean.toString(SLPCore.CONFIG.getDebugEnabled())); >- > // track the LogService for life cycle events > context.addServiceListener(this, "(" + Constants.OBJECTCLASS + "=" + LogService.class.getName() + ")"); > >Index: source-bundle/ch/ethz/iks/slp/impl/SLPCore.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.orbit/ch.ethz.iks.slp/source-bundle/ch/ethz/iks/slp/impl/Attic/SLPCore.java,v >retrieving revision 1.1.2.2 >diff -u -r1.1.2.2 SLPCore.java >--- source-bundle/ch/ethz/iks/slp/impl/SLPCore.java 9 Jun 2008 15:22:31 -0000 1.1.2.2 >+++ source-bundle/ch/ethz/iks/slp/impl/SLPCore.java 20 Aug 2008 11:20:01 -0000 >@@ -65,6 +65,8 @@ > * @since 0.6 > */ > public abstract class SLPCore { >+ private static volatile boolean isMulticastSocketInitialized = false; >+ private static volatile boolean isInitialized = false; > > protected static PlatformAbstraction platform; > >@@ -225,7 +227,8 @@ > config = propFile.exists() ? new SLPConfiguration(propFile) > : new SLPConfiguration(); > } catch (IOException e1) { >- platform.logWarning("Could not parse the property file", e1); >+ System.out.println("Could not parse the property file" + propFile.toString()); >+ e1.printStackTrace(); > config = new SLPConfiguration(); > } > CONFIG = config; >@@ -270,32 +273,15 @@ > } > > protected static void init() { >+ if(isInitialized) { >+ return; >+ } >+ isInitialized = true; >+ > platform.logDebug("jSLP is running on the following interfaces: " > + java.util.Arrays.asList(myIPs)); > platform.logDebug("jSLP is using port: " + SLP_PORT); > >- // a pure UA doesn't need a multicast listener which is only required by an SA and DA >- if(!CONFIG.isUAOnly()) { >- try { >- mtcSocket = new MulticastSocket(SLP_PORT); >- mtcSocket.setTimeToLive(CONFIG.getMcastTTL()); >- if (CONFIG.getInterfaces() != null) { >- try { >- mtcSocket.setInterface(InetAddress.getByName(myIPs[0])); >- } catch (Throwable t) { >- >- } >- } >- mtcSocket.joinGroup(MCAST_ADDRESS); >- } catch (BindException be) { >- platform.logError(be.getMessage(), be); >- throw new RuntimeException("You have to be root to open port " >- + SLP_PORT); >- } catch (Exception e) { >- platform.logError(e.getMessage(), e); >- } >- } >- > String[] daAddresses = CONFIG.getDaAddresses(); > if (daAddresses == null) { > if (noDiscovery) { >@@ -332,62 +318,12 @@ > } > } > >- // a pure UA doesn't need a multicast listener which is only required by an SA and DA >- if(!CONFIG.isUAOnly()) { >- // setup and start the multicast thread >- multicastThread = new Thread() { >- public void run() { >- DatagramPacket packet; >- byte[] bytes = new byte[SLPCore.CONFIG.getMTU()]; >- while (true) { >- try { >- packet = new DatagramPacket(bytes, bytes.length); >- mtcSocket.receive(packet); >- final SLPMessage reply = handleMessage(SLPMessage >- .parse(packet.getAddress(), packet.getPort(), >- new DataInputStream( >- new ByteArrayInputStream(packet >- .getData())), false)); >- if (reply != null) { >- final byte[] repbytes = reply.getBytes(); >- DatagramPacket datagramPacket = new DatagramPacket( >- repbytes, repbytes.length, reply.address, >- reply.port); >- mtcSocket.send(datagramPacket); >- platform.logDebug("SEND (" + reply.address >- + ":" + reply.port + ") " >- + reply.toString()); >- } else { >- platform >- .logDebug("Datagram couldn't be parsed as a SLPMessage"); >- } >- } catch (Exception e) { >- platform >- .logError( >- "Exception in Multicast Receiver Thread", >- e); >- } >- } >- } >- }; >- multicastThread.start(); >- >- // check, if there is already a SLP daemon runnung on port 427 >- // that can be either a jSLP daemon, or an OpenSLP daemon or something >- // else. If not, try to start a new daemon instance. >- if (daemonConstr != null) { >- try { >- daemon = (SLPDaemon) daemonConstr.newInstance(null); >- } catch (Exception e) { >- daemon = null; >- } >- } >- } >- > if (!noDiscovery) { > // perform an initial lookup > try { >- daLookup(null); >+ List scopes = new ArrayList(); >+ scopes.add("default"); >+ daLookup(scopes); > } catch (Exception e) { > platform.logError("Exception in initial DA lookup", e); > } >@@ -395,6 +331,79 @@ > > } > >+ // a pure UA doesn't need a multicast listener which is only required by a SA or DA >+ protected static void initMulticastSocket() { >+ if(isMulticastSocketInitialized) { >+ return; >+ } >+ isMulticastSocketInitialized = true; >+ >+ try { >+ mtcSocket = new MulticastSocket(SLP_PORT); >+ mtcSocket.setTimeToLive(CONFIG.getMcastTTL()); >+ if (CONFIG.getInterfaces() != null) { >+ try { >+ mtcSocket.setInterface(InetAddress.getByName(myIPs[0])); >+ } catch (Throwable t) { >+ platform.logDebug("Setting multicast socket interface to " + myIPs[0] + " failed.",t); >+ } >+ } >+ mtcSocket.joinGroup(MCAST_ADDRESS); >+ } catch (BindException be) { >+ platform.logError(be.getMessage(), be); >+ throw new RuntimeException("You have to be root to open port " >+ + SLP_PORT); >+ } catch (Exception e) { >+ platform.logError(e.getMessage(), e); >+ } >+ >+ // setup and start the multicast thread >+ multicastThread = new Thread() { >+ public void run() { >+ DatagramPacket packet; >+ byte[] bytes = new byte[SLPCore.CONFIG.getMTU()]; >+ while (true) { >+ try { >+ packet = new DatagramPacket(bytes, bytes.length); >+ mtcSocket.receive(packet); >+ final SLPMessage reply = handleMessage(SLPMessage >+ .parse(packet.getAddress(), packet.getPort(), >+ new DataInputStream( >+ new ByteArrayInputStream(packet >+ .getData())), false)); >+ if (reply != null) { >+ final byte[] repbytes = reply.getBytes(); >+ DatagramPacket datagramPacket = new DatagramPacket( >+ repbytes, repbytes.length, reply.address, >+ reply.port); >+ mtcSocket.send(datagramPacket); >+ platform.logDebug("SEND (" + reply.address >+ + ":" + reply.port + ") " >+ + reply.toString()); >+ } >+ } catch (Exception e) { >+ platform >+ .logError( >+ "Exception in Multicast Receiver Thread", >+ e); >+ } >+ } >+ } >+ }; >+ multicastThread.start(); >+ >+ // check, if there is already a SLP daemon runnung on port 427 >+ // that can be either a jSLP daemon, or an OpenSLP daemon or something >+ // else. If not, try to start a new daemon instance. >+ if (daemonConstr != null) { >+ try { >+ daemon = (SLPDaemon) daemonConstr.newInstance(null); >+ } catch (Exception e) { >+ daemon = null; >+ } >+ } >+ } >+ > /** > * get my own IP. > * >@@ -451,6 +460,9 @@ > DAAdvertisement advert = (DAAdvertisement) message; > > if (advert.errorCode != 0) { >+ platform.logTraceDrop("DROPPED DAADvertisement (" + advert.address + ":" >+ + advert.port + ") " + advert.toString() >+ + "(reason: " + advert.errorCode + " != 0"); > return null; > } > >@@ -546,15 +558,23 @@ > // message to the daemon. > if (daemon != null) { > return daemon.handleMessage(message); >+ } else { >+ platform.logDebug("SRVTYPERQST recieved (" >+ + message.address + ":" + message.port + ") " >+ + message.toString() >+ + " but no SLPDaemon to handle the message present"); >+ return null; > } >- >- return null; > default: > // if we have a daemon instance, delegate all other > // messages to the daemon. > if (daemon != null) { > return daemon.handleMessage(message); > } else { >+ platform.logDebug("A message recieved (" >+ + message.address + ":" + message.port + ") " >+ + message.toString() >+ + " but no SLPDaemon to handle the message present"); > return null; > } > } >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.orbit/ch.ethz.iks.slp/META-INF/Attic/MANIFEST.MF,v >retrieving revision 1.1.2.4 >diff -u -r1.1.2.4 MANIFEST.MF >--- META-INF/MANIFEST.MF 9 Jun 2008 15:22:36 -0000 1.1.2.4 >+++ META-INF/MANIFEST.MF 20 Aug 2008 11:20:01 -0000 >@@ -2,7 +2,7 @@ > Bundle-ManifestVersion: 2 > Bundle-Name: %pluginName > Bundle-SymbolicName: ch.ethz.iks.slp >-Bundle-Version: 1.0.0.RC4_qualifier >+Bundle-Version: 1.0.0.RC5_qualifier > Bundle-Vendor: %providerName > Bundle-Localization: plugin > Export-Package: ch.ethz.iks.slp;version="1.0.0", >Index: source-bundle/META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.orbit/ch.ethz.iks.slp/source-bundle/META-INF/Attic/MANIFEST.MF,v >retrieving revision 1.1.2.2 >diff -u -r1.1.2.2 MANIFEST.MF >--- source-bundle/META-INF/MANIFEST.MF 26 Feb 2008 02:45:46 -0000 1.1.2.2 >+++ source-bundle/META-INF/MANIFEST.MF 20 Aug 2008 11:20:01 -0000 >@@ -2,7 +2,7 @@ > Bundle-ManifestVersion: 2 > Bundle-Name: %pluginName > Bundle-SymbolicName: ch.ethz.iks.slp.source >-Bundle-Version: 1.0.0.RC2_qualifier >+Bundle-Version: 1.0.0.RC5_qualifier > Bundle-Localization: plugin > Bundle-Vendor: %providerName >-Eclipse-SourceBundle: ch.ethz.iks.slp;version="1.0.0.RC2_qualifier" >+Eclipse-SourceBundle: ch.ethz.iks.slp;version="1.0.0.RC5_qualifier"
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 244678
: 110435 |
110436