use of com.biglybt.core.dht.transport.udp.DHTTransportUDPContact in project BiglyBT by BiglySoftware.
the class DHTNATPuncherImpl method punch.
@Override
public Map punch(String reason, DHTTransportContact _target, DHTTransportContact[] rendezvous_used, Map originator_client_data) {
DHTTransportUDPContact target = (DHTTransportUDPContact) _target;
try {
DHTTransportContact rendezvous = null;
if (rendezvous_used != null && rendezvous_used.length > 0) {
rendezvous = rendezvous_used[0];
}
if (rendezvous == null) {
rendezvous = getRendezvous(reason, target);
}
if (rendezvous_used != null && rendezvous_used.length > 0) {
rendezvous_used[0] = rendezvous;
}
if (rendezvous == null) {
return (null);
}
Map target_client_data = sendPunch(rendezvous, target, originator_client_data, false);
if (target_client_data != null) {
log(" punch to " + target.getString() + " succeeded");
punch_send_ok++;
return (target_client_data);
}
} catch (Throwable e) {
log(e);
}
punch_send_fail++;
log(" punch to " + target.getString() + " failed");
return (null);
}
Aggregations