use of com.biglybt.pif.dht.mainline.MainlineDHTProvider in project BiglyBT by BiglySoftware.
the class PEPeerTransportProtocol method decodeMainlineDHTPort.
protected void decodeMainlineDHTPort(BTDHTPort port) {
int i_port = port.getDHTPort();
port.destroy();
if (!this.ml_dht_enabled) {
return;
}
MainlineDHTProvider provider = getDHTProvider();
if (provider == null) {
return;
}
if (network == AENetworkClassifier.AT_PUBLIC) {
try {
provider.notifyOfIncomingPort(getIp(), i_port);
} catch (Throwable t) {
Debug.printStackTrace(t);
}
}
}
use of com.biglybt.pif.dht.mainline.MainlineDHTProvider in project BiglyBT by BiglySoftware.
the class MainlineDHTManagerImpl method setProvider.
@Override
public void setProvider(MainlineDHTProvider provider) {
MainlineDHTProvider old_provider = core.getGlobalManager().getMainlineDHTProvider();
core.getGlobalManager().setMainlineDHTProvider(provider);
// Registering new provider, so enable global DHT support.
if (old_provider == null && provider != null) {
BTHandshake.setMainlineDHTEnabled(true);
// We no longer dynamically register and unregister the message type.
//
// This is because if the message type is tied to the BT protocol itself,
// which we don't support dynamic registering / unregistering of.
// try {MessageManager.getSingleton().registerMessageType(new BTDHTPort(-1));}
// catch (MessageException me) {Debug.printStackTrace(me);}
} else // Deregistering existing provider, so disable global DHT support.
if (old_provider != null && provider == null) {
BTHandshake.setMainlineDHTEnabled(false);
// MessageManager.getSingleton().deregisterMessageType(new BTDHTPort(-1));
}
}
use of com.biglybt.pif.dht.mainline.MainlineDHTProvider in project BiglyBT by BiglySoftware.
the class PEPeerTransportProtocol method sendMainlineDHTPort.
private void sendMainlineDHTPort() {
if (!this.ml_dht_enabled) {
return;
}
MainlineDHTProvider provider = getDHTProvider();
if (provider == null) {
return;
}
Message message = new BTDHTPort(provider.getDHTPort());
connection.getOutgoingMessageQueue().addMessage(message, false);
}
Aggregations