public abstract class BaseRelayServer extends DispatchHandler implements PeerStatusListener
| Modifier | Constructor and Description |
|---|---|
protected |
BaseRelayServer(Peer peer,
PeerAddress unreachablePeer,
RelayType relayType) |
| Modifier and Type | Method and Description |
|---|---|
void |
addOfflineListener(OfflineListener listener) |
abstract FutureDone<Message> |
forwardToUnreachable(Message message)
Forwards a message to the unrachable peer.
|
Collection<PeerAddress> |
getPeerMap()
Returns the current peer map from the mobile device
|
void |
handleResponse(Message message,
PeerConnection peerConnection,
boolean sign,
Responder responder)
Receive a message at the relay server from a given peer
|
void |
handleResponse(Message message,
Responder responder)
Receive a message at the relay server from a given peer
|
protected abstract boolean |
isAlive()
Checks whether the relayed peer is still alive.
|
protected void |
notifyOfflineListeners() |
boolean |
peerFailed(PeerAddress remotePeer,
PeerException exception) |
boolean |
peerFound(PeerAddress remotePeer,
PeerAddress referrer,
PeerConnection peerConnection,
RTT roundTripTime) |
protected abstract void |
peerMapUpdated(Message originalMessage,
Message preparedResponse)
Is called when the unreachable peer sent an update to the relay peer.
|
Number160 |
relayPeerId() |
void |
setPeerMap(List<Map<Number160,PeerStatistic>> peerMap,
Message requestMessage,
Message preparedResponse)
Update the peerMap of the unreachable peer
|
PeerAddress |
unreachablePeerAddress() |
protected Number160 |
unreachablePeerId() |
connectionBean, createMessage, createResponseMessage, createResponseMessage, forwardMessage, peerBean, register, register, signprotected BaseRelayServer(Peer peer, PeerAddress unreachablePeer, RelayType relayType)
public final PeerAddress unreachablePeerAddress()
protected final Number160 unreachablePeerId()
public void addOfflineListener(OfflineListener listener)
protected void notifyOfflineListeners()
public final boolean peerFailed(PeerAddress remotePeer, PeerException exception)
peerFailed in interface PeerStatusListenerpublic final boolean peerFound(PeerAddress remotePeer, PeerAddress referrer, PeerConnection peerConnection, RTT roundTripTime)
peerFound in interface PeerStatusListenerpublic final Number160 relayPeerId()
public final void handleResponse(Message message, PeerConnection peerConnection, boolean sign, Responder responder) throws Exception
handleResponse in class DispatchHandlerExceptionpublic final void handleResponse(Message message, Responder responder)
public abstract FutureDone<Message> forwardToUnreachable(Message message)
message - the message that is intended for the unreachable peerprotected abstract boolean isAlive()
public final Collection<PeerAddress> getPeerMap()
public final void setPeerMap(List<Map<Number160,PeerStatistic>> peerMap, Message requestMessage, Message preparedResponse)
peerMap - the extracted peer maprequestMessage - the original message that contained the extracted peer mappreparedResponse - the response that will be sent to the unreachable peerprotected abstract void peerMapUpdated(Message originalMessage, Message preparedResponse)
originalMessage - the original message that contained the extracted peer mapCopyright © 2015. All rights reserved.