com.frostwire.jlibtorrent.alerts.DhtErrorAlert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jlibtorrent Show documentation
Show all versions of jlibtorrent Show documentation
A swig Java interface for libtorrent by the makers of FrostWire.
package com.frostwire.jlibtorrent.alerts;
import com.frostwire.jlibtorrent.ErrorCode;
import com.frostwire.jlibtorrent.swig.dht_error_alert;
/**
* Posted when something fails in the DHT. This is not necessarily a fatal
* error, but it could prevent proper operation.
*
* @author gubatron
* @author aldenml
*/
public final class DhtErrorAlert extends AbstractAlert {
DhtErrorAlert(dht_error_alert alert) {
super(alert);
}
/**
* The error code.
*
* @return
*/
public ErrorCode error() {
return new ErrorCode(alert.getError());
}
/**
* the operation that failed
*
* @return
*/
public Operation operation() {
return Operation.fromSwig(alert.getOperation());
}
public enum Operation {
UNKNOWN(dht_error_alert.op_t.unknown),
HOSTNAME_LOOKUP(dht_error_alert.op_t.hostname_lookup);
private Operation(dht_error_alert.op_t swigObj) {
this.swigObj = swigObj;
}
private final dht_error_alert.op_t swigObj;
public dht_error_alert.op_t getSwig() {
return swigObj;
}
public static Operation fromSwig(dht_error_alert.op_t swigObj) {
Operation[] enumValues = Operation.class.getEnumConstants();
for (Operation ev : enumValues) {
if (ev.getSwig() == swigObj) {
return ev;
}
}
throw new IllegalArgumentException("No enum " + Operation.class + " with swig value " + swigObj);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy