Ejemplo n.º 1
0
 public void onTrace(
     long uid,
     double nearest,
     double best,
     short htl,
     short counter,
     short uniqueCounter,
     double location,
     long myUID,
     ShortBuffer peerLocs,
     ShortBuffer peerUIDs,
     short forkCount,
     short linearCounter,
     String reason,
     long prevUID)
     throws NotConnectedException {
   Message trace =
       DMT.createFNPRHProbeTrace(
           uid,
           nearest,
           best,
           htl,
           counter,
           uniqueCounter,
           location,
           myUID,
           peerLocs,
           peerUIDs,
           forkCount,
           linearCounter,
           reason,
           prevUID);
   source.sendAsync(trace, null, sender);
 }
Ejemplo n.º 2
0
 static void start(Message m, PeerNode source, Node n, double target) {
   long uid = m.getLong(DMT.UID);
   double nearestLoc = m.getDouble(DMT.NEAREST_LOCATION);
   double best = m.getDouble(DMT.BEST_LOCATION);
   short htl = m.getShort(DMT.HTL);
   ProbeRequestSender sender =
       new ProbeRequestSender(target, htl, uid, n, nearestLoc, source, best);
   ProbeRequestHandler handler = new ProbeRequestHandler(source, uid, sender);
   sender.addListener(handler);
   PeerNode[] peers = n.peers.connectedPeers;
   Message accepted = DMT.createFNPAccepted(uid);
   Message trace =
       DMT.createFNPRHProbeTrace(
           uid,
           sender.getNearestLoc(),
           sender.getBest(),
           htl,
           (short) 1,
           (short) 1,
           n.getLocation(),
           n.swapIdentifier,
           LocationManager.extractLocs(peers, true),
           LocationManager.extractUIDs(peers),
           (short) 0,
           (short) 1,
           "",
           source.swapIdentifier);
   try {
     source.sendAsync(accepted, null, sender);
     source.sendAsync(trace, null, sender);
   } catch (NotConnectedException e) {
     // We completed(id), rather than locking it, so we don't need to unlock.
     return; // So all we need to do is not start the sender.
   }
   sender.start();
 }