-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.frostwire.jlibtorrent.alerts; | ||
|
||
import com.frostwire.jlibtorrent.Sha1Hash; | ||
import com.frostwire.jlibtorrent.TcpEndpoint; | ||
import com.frostwire.jlibtorrent.swig.dht_get_peers_reply_alert; | ||
import com.frostwire.jlibtorrent.swig.tcp_endpoint_vector; | ||
|
||
import java.util.ArrayList; | ||
|
||
/** | ||
* @author gubatron | ||
* @author aldenml | ||
*/ | ||
public final class DhtGetPeersReplyAlert extends AbstractAlert<dht_get_peers_reply_alert> { | ||
|
||
public DhtGetPeersReplyAlert(dht_get_peers_reply_alert alert) { | ||
super(alert); | ||
} | ||
|
||
public Sha1Hash getInfoHash() { | ||
return new Sha1Hash(alert.getInfo_hash()); | ||
} | ||
|
||
public ArrayList<TcpEndpoint> getPeers() { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
aldenml
Author
Collaborator
|
||
tcp_endpoint_vector v = alert.getPeers(); | ||
int size = (int) v.size(); | ||
ArrayList<TcpEndpoint> peers = new ArrayList<TcpEndpoint>(size); | ||
|
||
for (int i = 0; i < size; i++) { | ||
peers.add(new TcpEndpoint(v.get(i))); | ||
} | ||
|
||
return peers; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* ---------------------------------------------------------------------------- | ||
* This file was automatically generated by SWIG (http://www.swig.org). | ||
* Version 3.0.2 | ||
* | ||
* Do not make changes to this file unless you know what you are doing--modify | ||
* the SWIG interface file instead. | ||
* ----------------------------------------------------------------------------- */ | ||
|
||
package com.frostwire.jlibtorrent.swig; | ||
|
||
public class dht_get_peers_reply_alert extends alert { | ||
private long swigCPtr; | ||
|
||
protected dht_get_peers_reply_alert(long cPtr, boolean cMemoryOwn) { | ||
super(libtorrent_jni.dht_get_peers_reply_alert_SWIGUpcast(cPtr), cMemoryOwn); | ||
swigCPtr = cPtr; | ||
} | ||
|
||
protected static long getCPtr(dht_get_peers_reply_alert obj) { | ||
return (obj == null) ? 0 : obj.swigCPtr; | ||
} | ||
|
||
protected void finalize() { | ||
delete(); | ||
} | ||
|
||
public synchronized void delete() { | ||
if (swigCPtr != 0) { | ||
if (swigCMemOwn) { | ||
swigCMemOwn = false; | ||
libtorrent_jni.delete_dht_get_peers_reply_alert(swigCPtr); | ||
} | ||
swigCPtr = 0; | ||
} | ||
super.delete(); | ||
} | ||
|
||
public dht_get_peers_reply_alert(sha1_hash ih, tcp_endpoint_vector v) { | ||
this(libtorrent_jni.new_dht_get_peers_reply_alert(sha1_hash.getCPtr(ih), ih, tcp_endpoint_vector.getCPtr(v), v), true); | ||
} | ||
|
||
public int type() { | ||
return libtorrent_jni.dht_get_peers_reply_alert_type(swigCPtr, this); | ||
} | ||
|
||
public int category() { | ||
return libtorrent_jni.dht_get_peers_reply_alert_category(swigCPtr, this); | ||
} | ||
|
||
public String what() { | ||
return libtorrent_jni.dht_get_peers_reply_alert_what(swigCPtr, this); | ||
} | ||
|
||
public String message() { | ||
return libtorrent_jni.dht_get_peers_reply_alert_message(swigCPtr, this); | ||
} | ||
|
||
public void setInfo_hash(sha1_hash value) { | ||
libtorrent_jni.dht_get_peers_reply_alert_info_hash_set(swigCPtr, this, sha1_hash.getCPtr(value), value); | ||
} | ||
|
||
public sha1_hash getInfo_hash() { | ||
long cPtr = libtorrent_jni.dht_get_peers_reply_alert_info_hash_get(swigCPtr, this); | ||
return (cPtr == 0) ? null : new sha1_hash(cPtr, false); | ||
} | ||
|
||
public void setPeers(tcp_endpoint_vector value) { | ||
libtorrent_jni.dht_get_peers_reply_alert_peers_set(swigCPtr, this, tcp_endpoint_vector.getCPtr(value), value); | ||
} | ||
|
||
public tcp_endpoint_vector getPeers() { | ||
long cPtr = libtorrent_jni.dht_get_peers_reply_alert_peers_get(swigCPtr, this); | ||
return (cPtr == 0) ? null : new tcp_endpoint_vector(cPtr, false); | ||
} | ||
|
||
public final static int alert_type = libtorrent_jni.dht_get_peers_reply_alert_alert_type_get(); | ||
public final static int static_category = libtorrent_jni.dht_get_peers_reply_alert_static_category_get(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* ---------------------------------------------------------------------------- | ||
* This file was automatically generated by SWIG (http://www.swig.org). | ||
* Version 3.0.2 | ||
* | ||
* Do not make changes to this file unless you know what you are doing--modify | ||
* the SWIG interface file instead. | ||
* ----------------------------------------------------------------------------- */ | ||
|
||
package com.frostwire.jlibtorrent.swig; | ||
|
||
public class tcp_endpoint_vector { | ||
private long swigCPtr; | ||
protected boolean swigCMemOwn; | ||
|
||
protected tcp_endpoint_vector(long cPtr, boolean cMemoryOwn) { | ||
swigCMemOwn = cMemoryOwn; | ||
swigCPtr = cPtr; | ||
} | ||
|
||
protected static long getCPtr(tcp_endpoint_vector obj) { | ||
return (obj == null) ? 0 : obj.swigCPtr; | ||
} | ||
|
||
protected void finalize() { | ||
delete(); | ||
} | ||
|
||
public synchronized void delete() { | ||
if (swigCPtr != 0) { | ||
if (swigCMemOwn) { | ||
swigCMemOwn = false; | ||
libtorrent_jni.delete_tcp_endpoint_vector(swigCPtr); | ||
} | ||
swigCPtr = 0; | ||
} | ||
} | ||
|
||
public tcp_endpoint_vector() { | ||
this(libtorrent_jni.new_tcp_endpoint_vector(), true); | ||
} | ||
|
||
public long size() { | ||
return libtorrent_jni.tcp_endpoint_vector_size(swigCPtr, this); | ||
} | ||
|
||
public long capacity() { | ||
return libtorrent_jni.tcp_endpoint_vector_capacity(swigCPtr, this); | ||
} | ||
|
||
public void reserve(long n) { | ||
libtorrent_jni.tcp_endpoint_vector_reserve(swigCPtr, this, n); | ||
} | ||
|
||
public boolean isEmpty() { | ||
return libtorrent_jni.tcp_endpoint_vector_isEmpty(swigCPtr, this); | ||
} | ||
|
||
public void clear() { | ||
libtorrent_jni.tcp_endpoint_vector_clear(swigCPtr, this); | ||
} | ||
|
||
public void add(tcp_endpoint x) { | ||
libtorrent_jni.tcp_endpoint_vector_add(swigCPtr, this, tcp_endpoint.getCPtr(x), x); | ||
} | ||
|
||
public tcp_endpoint get(int i) { | ||
return new tcp_endpoint(libtorrent_jni.tcp_endpoint_vector_get(swigCPtr, this, i), false); | ||
} | ||
|
||
public void set(int i, tcp_endpoint val) { | ||
libtorrent_jni.tcp_endpoint_vector_set(swigCPtr, this, i, tcp_endpoint.getCPtr(val), val); | ||
} | ||
|
||
} |
1 comment
on commit bc3de69
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are a monster @aldenml
TcpEndpoint
?how is that possible? isn't the whole thing in UDP?