Search in sources :

Example 1 with DHTControlListener

use of com.biglybt.core.dht.control.DHTControlListener in project BiglyBT by BiglySoftware.

the class DHTView method init.

private void init(Core core) {
    try {
        PluginInterface dht_pi = core.getPluginManager().getPluginInterfaceByClass(DHTPlugin.class);
        if (dht_pi == null) {
            return;
        }
        DHT[] dhts = ((DHTPlugin) dht_pi.getPlugin()).getDHTs();
        for (int i = 0; i < dhts.length; i++) {
            if (dhts[i].getTransport().getNetwork() == dht_type) {
                dht = dhts[i];
                break;
            }
        }
        if (dht == null) {
            return;
        }
        controlListener = new DHTControlListener() {

            @Override
            public void activityChanged(DHTControlActivity activity, int type) {
                activityChanged = true;
            }
        };
        dht.getControl().addListener(controlListener);
    } catch (Exception e) {
        Debug.printStackTrace(e);
    }
}
Also used : DHT(com.biglybt.core.dht.DHT) PluginInterface(com.biglybt.pif.PluginInterface) DHTControlActivity(com.biglybt.core.dht.control.DHTControlActivity) DHTPlugin(com.biglybt.plugin.dht.DHTPlugin) DHTControlListener(com.biglybt.core.dht.control.DHTControlListener)

Example 2 with DHTControlListener

use of com.biglybt.core.dht.control.DHTControlListener in project BiglyBT by BiglySoftware.

the class DHTView method setDHT.

public void setDHT(DHT _dht) {
    if (dht == null) {
        dht = _dht;
        controlListener = new DHTControlListener() {

            @Override
            public void activityChanged(DHTControlActivity activity, int type) {
                activityChanged = true;
            }
        };
        dht.getControl().addListener(controlListener);
    } else if (dht == _dht) {
    } else {
        Debug.out("Not Supported ");
    }
}
Also used : DHTControlActivity(com.biglybt.core.dht.control.DHTControlActivity) DHTControlListener(com.biglybt.core.dht.control.DHTControlListener)

Aggregations

DHTControlActivity (com.biglybt.core.dht.control.DHTControlActivity)2 DHTControlListener (com.biglybt.core.dht.control.DHTControlListener)2 DHT (com.biglybt.core.dht.DHT)1 PluginInterface (com.biglybt.pif.PluginInterface)1 DHTPlugin (com.biglybt.plugin.dht.DHTPlugin)1