コード例 #1
0
ファイル: DHTNATPuncherImpl.java プロジェクト: aprasa/oldwork
  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);
  }
コード例 #2
0
ファイル: DHTNATPuncherImpl.java プロジェクト: aprasa/oldwork
  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));
  }