Ejemplo n.º 1
0
  protected byte[] getPublishKey(DHTTransportContact contact) {
    byte[] id = contact.getID();
    byte[] suffix = ":DHTNATPuncher".getBytes();

    byte[] res = new byte[id.length + suffix.length];

    System.arraycopy(id, 0, res, 0, id.length);
    System.arraycopy(suffix, 0, res, id.length, suffix.length);

    return (res);
  }
Ejemplo n.º 2
0
  protected void receiveClose(DHTTransportUDPContact originator, Map request, Map response) {
    trace("received close request");

    final DHTTransportContact current_target = rendezvous_target;

    if (current_target != null && Arrays.equals(current_target.getID(), originator.getID())) {

      new AEThread2("DHTNATPuncher:close", true) {
        public void run() {
          rendezvousFailed(current_target, true);
        }
      }.start();
    }

    response.put("ok", new Long(1));
  }