|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.google.bitcoin.jni.NativePeerEventListener
public class NativePeerEventListener
An event listener that relays events to a native C++ object. A pointer to that object is stored in this class using JNI on the native side, thus several instances of this can point to different actual native implementations.
| Field Summary | |
|---|---|
long |
ptr
|
| Constructor Summary | |
|---|---|
NativePeerEventListener()
|
|
| Method Summary | |
|---|---|
List<Message> |
getData(Peer peer,
GetDataMessage m)
Called when a peer receives a getdata message, usually in response to an "inv" being broadcast. |
void |
onBlocksDownloaded(Peer peer,
Block block,
int blocksLeft)
Called on a Peer thread when a block is received. |
void |
onChainDownloadStarted(Peer peer,
int blocksLeft)
Called when a download is started with the initial number of blocks to be downloaded. |
void |
onPeerConnected(Peer peer,
int peerCount)
Called when a peer is connected. |
void |
onPeerDisconnected(Peer peer,
int peerCount)
Called when a peer is disconnected. |
Message |
onPreMessageReceived(Peer peer,
Message m)
Called when a message is received by a peer, before the message is processed. |
void |
onTransaction(Peer peer,
Transaction t)
Called when a new transaction is broadcast over the network. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public long ptr
| Constructor Detail |
|---|
public NativePeerEventListener()
| Method Detail |
|---|
public void onBlocksDownloaded(Peer peer,
Block block,
int blocksLeft)
PeerEventListenerThe block may have transactions or may be a header only once getheaders is implemented.
onBlocksDownloaded in interface PeerEventListenerpeer - the peer receiving the blockblock - the downloaded blockblocksLeft - the number of blocks left to download
public void onChainDownloadStarted(Peer peer,
int blocksLeft)
PeerEventListener
onChainDownloadStarted in interface PeerEventListenerpeer - the peer receiving the blockblocksLeft - the number of blocks left to download
public void onPeerConnected(Peer peer,
int peerCount)
PeerEventListenerPeer instead of a PeerGroup,
peerCount will always be 1.
onPeerConnected in interface PeerEventListenerpeerCount - the total number of connected peers
public void onPeerDisconnected(Peer peer,
int peerCount)
PeerEventListenerPeerGroup and the group is in the process of shutting down. If this listener is registered to a
Peer instead of a PeerGroup, peerCount will always be 0.
onPeerDisconnected in interface PeerEventListenerpeerCount - the total number of connected peers
public Message onPreMessageReceived(Peer peer,
Message m)
PeerEventListenerCalled when a message is received by a peer, before the message is processed. The returned message is processed instead. Returning null will cause the message to be ignored by the Peer returning the same message object allows you to see the messages received but not change them. The result from one event listeners callback is passed as "m" to the next, forming a chain.
Note that this will never be called if registered with any executor other than
Threading.SAME_THREAD
onPreMessageReceived in interface PeerEventListener
public void onTransaction(Peer peer,
Transaction t)
PeerEventListener
onTransaction in interface PeerEventListener
public List<Message> getData(Peer peer,
GetDataMessage m)
PeerEventListenerCalled when a peer receives a getdata message, usually in response to an "inv" being broadcast. Return as many
items as possible which appear in the GetDataMessage, or null if you're not interested in responding.
Note that this will never be called if registered with any executor other than
Threading.SAME_THREAD
getData in interface PeerEventListener
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||