log( "Removing publish for " + current_local.getString() + " -> " + current_target.getString());
dht.remove(
getPublishKey( current_local ),
"DHTNatPuncher: removal of publish",
new DHTOperationListener()
{
public void
searching(
DHTTransportContact contact,
int level,
int active_searches )
{}
public void
found(
DHTTransportContact contact,
boolean is_closest )
{}
public void
diversified(
String desc )
{
}
public void
read(
DHTTransportContact contact,
DHTTransportValue value )
{}
public void
wrote(
DHTTransportContact contact,
DHTTransportValue value )
{}
public void
complete(
boolean timeout )
{}
});
}
if ( latest_local != null ){
log( "Adding publish for " + latest_local.getString() + " -> " + latest_target.getString());
rendevzous_fail_count = RENDEZVOUS_PING_FAIL_LIMIT - 2; // only 2 attempts to start with
dht.put(
getPublishKey( latest_local ),
"NAT Traversal: rendezvous publish",
encodePublishValue( latest_target ),
DHT.FLAG_SINGLE_VALUE,
new DHTOperationListener()
{
public void
searching(
DHTTransportContact contact,
int level,
int active_searches )
{}
public void
found(
DHTTransportContact contact,
boolean is_closest )
{}
public void
diversified(
String desc )
{
}
public void
read(
DHTTransportContact contact,
DHTTransportValue value )
{}
public void
wrote(
DHTTransportContact contact,
DHTTransportValue value )
{}
public void
complete(
boolean timeout )
{}
});
}
}else if ( current_target != latest_target ){
// here current_local == latest_local and neither is null!
// target changed, update publish
log( "Updating publish for " + latest_local.getString() + " -> " + latest_target.getString());
rendevzous_fail_count = RENDEZVOUS_PING_FAIL_LIMIT - 2; // only 2 attempts to start with
dht.put(
getPublishKey( latest_local ),
"DHTNatPuncher: update publish",
encodePublishValue( latest_target ),
DHT.FLAG_SINGLE_VALUE,
new DHTOperationListener()
{
public void
searching(
DHTTransportContact contact,
int level,