Example #1
0
 def manageAdd(cls, action):
     """Add a probe to the DHT
     :param action: Add action containing the probe to add
     """
     assert isinstance(action, a.Add)
     cls.logger.debug("Managing Add task")
     #add the probe to the local DHT
     ProbeStorage.addProbe(ProbeStorage.newProbe(action.getIdSonde(), action.getIpSonde()))
     if action.hello is not None:
         # tell the new probe about all other probe
         Client.send(action.hello)
     cls.logger.info("Added probe %s, id %s to known probes", action.getIpSonde(), action.getIdSonde())
Example #2
0
 def manageUpdateProbes(cls, action):
     """Update your list of probes with this set of probes
     :param action: UpdateProbes action instance
     """
     assert isinstance(action, a.UpdateProbes)
     cls.logger.info("Joined overlay size %s", len(action.getProbeList()))
     if action.echo is not None:
         Client.send(Hello(action.echo, list(ProbeStorage.getAllOtherProbes()), Identification.PROBE_ID))
         cls.logger.info("Sent echo to %s", action.echo)
     for probe in action.getProbeList():
         # don't re-add ourselves to the local DHT
         if probe.getId() != Identification.PROBE_ID:
             ProbeStorage.addProbe(ProbeStorage.newProbe(probe.getId(), probe.getIp()))
Example #3
0
 def manageAdd(cls, action):
     """Add a probe to the DHT
     :param action: Add action containing the probe to add
     """
     assert isinstance(action, a.Add)
     cls.logger.debug("Managing Add task")
     #add the probe to the local DHT
     ProbeStorage.addProbe(
         ProbeStorage.newProbe(action.getIdSonde(), action.getIpSonde()))
     if action.hello is not None:
         # tell the new probe about all other probe
         Client.send(action.hello)
     cls.logger.info("Added probe %s, id %s to known probes",
                     action.getIpSonde(), action.getIdSonde())
Example #4
0
 def manageUpdateProbes(cls, action):
     """Update your list of probes with this set of probes
     :param action: UpdateProbes action instance
     """
     assert isinstance(action, a.UpdateProbes)
     cls.logger.info("Joined overlay size %s", len(action.getProbeList()))
     if action.echo is not None:
         Client.send(
             Hello(action.echo, list(ProbeStorage.getAllOtherProbes()),
                   Identification.PROBE_ID))
         cls.logger.info("Sent echo to %s", action.echo)
     for probe in action.getProbeList():
         # don't re-add ourselves to the local DHT
         if probe.getId() != Identification.PROBE_ID:
             ProbeStorage.addProbe(
                 ProbeStorage.newProbe(probe.getId(), probe.getIp()))