public void failed(int reason) { removeRequest( this, reason == NATTraversalObserver.FT_NO_RENDEZVOUS ? OUTCOME_FAILED_NO_REND : OUTCOME_FAILED_OTHER); adapter.failed(); }
public void succeeded(InetSocketAddress rendezvous, InetSocketAddress target, Map reply) { removeRequest(this, OUTCOME_SUCCESS); if (Logger.isEnabled()) { Logger.log( new LogEvent( LOGID, "NAT traversal for " + initiator.getDisplayName() + "/" + target + " succeeded")); } adapter.success(target); }
public void create( PeerNATInitiator initiator, InetSocketAddress target, PeerNATTraversalAdapter adapter) { boolean bad = false; synchronized (initiators) { if (negative_result_bloom.contains(target.toString().getBytes())) { bad = true; failed_negative_bloom++; } else { LinkedList requests = (LinkedList) initiators.get(initiator); if (requests == null) { // we get here when download stopped at same time // Debug.out( "initiator not found" ); bad = true; } else { PeerNATTraversal traversal = new PeerNATTraversal(initiator, target, adapter); requests.addLast(traversal); pending_requests.addLast(traversal); if (Logger.isEnabled()) { Logger.log( new LogEvent( LOGID, "created NAT traversal for " + initiator.getDisplayName() + "/" + target)); } } } } if (bad) { adapter.failed(); } }
protected void cancel() { NATTraversal active_traversal; synchronized (this) { cancelled = true; active_traversal = traversal; } if (active_traversal == null) { removeRequest(this, OUTCOME_FAILED_OTHER); } else { active_traversal.cancel(); } adapter.failed(); }
public void disabled() { removeRequest(this, OUTCOME_FAILED_OTHER); adapter.failed(); }
public void failed(Throwable cause) { removeRequest(this, OUTCOME_FAILED_OTHER); adapter.failed(); }