public class Sender extends Object
| Constructor and Description |
|---|
Sender(Number160 peerId,
List<PeerStatusListener> peerStatusListeners,
ChannelClientConfiguration channelClientConfiguration,
Dispatcher dispatcher,
SendBehavior sendBehavior,
PeerBean peerBean)
Creates a new sender with the listeners for offline peers.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterConnect(FutureResponse futureResponse,
Message message,
io.netty.channel.ChannelFuture channelFuture,
boolean fireAndForget)
After connecting, we check if the connect was successful.
|
ConcurrentHashMap<Integer,FutureResponse> |
cachedRequests()
Get currently cached requests.
|
ChannelClientConfiguration |
channelClientConfiguration() |
Map<String,Pair<io.netty.util.concurrent.EventExecutorGroup,io.netty.channel.ChannelHandler>> |
configureHandlers(io.netty.channel.SimpleChannelInboundHandler<Message> handler,
FutureResponse futureResponse,
int idleUDPSeconds,
boolean isFireAndForget)
This method was extracted in order to avoid duplicate code in the
HolePunchInitiator and in the initHolePunch(...) method. |
void |
handleHolePunch(FutureResponse futureResponse,
Message message,
ChannelCreator channelCreator,
int idleUDPSeconds) |
List<PeerStatusListener> |
peerStatusListeners() |
PingBuilderFactory |
pingBuilderFactory() |
Sender |
pingBuilderFactory(PingBuilderFactory pingBuilderFactory) |
void |
sendSelf(FutureResponse futureResponse,
Message message)
In case a message is sent to the sender itself, this is the cutoff.
|
void |
sendTCP(io.netty.channel.SimpleChannelInboundHandler<Message> handler,
FutureResponse futureResponse,
Message message,
ChannelCreator channelCreator,
int idleTCPSeconds,
int connectTimeoutMillis,
PeerConnection peerConnection)
Send a message via TCP.
|
void |
sendUDP(io.netty.channel.SimpleChannelInboundHandler<Message> handler,
FutureResponse futureResponse,
Message message,
ChannelCreator channelCreator,
int idleUDPSeconds,
boolean broadcast)
Send a message via UDP.
|
public Sender(Number160 peerId, List<PeerStatusListener> peerStatusListeners, ChannelClientConfiguration channelClientConfiguration, Dispatcher dispatcher, SendBehavior sendBehavior, PeerBean peerBean)
peerStatusListeners - The listener for offline peerschannelClientConfiguration - The configuration used to get the signature factorydispatcher - concurrentHashMap - public ChannelClientConfiguration channelClientConfiguration()
public PingBuilderFactory pingBuilderFactory()
public Sender pingBuilderFactory(PingBuilderFactory pingBuilderFactory)
public void sendTCP(io.netty.channel.SimpleChannelInboundHandler<Message> handler, FutureResponse futureResponse, Message message, ChannelCreator channelCreator, int idleTCPSeconds, int connectTimeoutMillis, PeerConnection peerConnection)
handler - The handler to deal with a reply messagefutureResponse - The future to set the responsemessage - The message to sendchannelCreator - The channel creator for the UPD channelidleTCPSeconds - The idle time of a message until we failconnectTimeoutMillis - The idle we set for the connection setuppublic void sendSelf(FutureResponse futureResponse, Message message)
futureResponse - the future to respond as soon as the proper handler returns itmessage - the requestpublic void sendUDP(io.netty.channel.SimpleChannelInboundHandler<Message> handler, FutureResponse futureResponse, Message message, ChannelCreator channelCreator, int idleUDPSeconds, boolean broadcast)
handler - The handler to deal with a reply messagefutureResponse - The future to set the responsemessage - The message to sendchannelCreator - The channel creator for the UPD channelidleUDPSeconds - The idle time of a message until we failbroadcast - True to send via layer 2 broadcastpublic void handleHolePunch(FutureResponse futureResponse, Message message, ChannelCreator channelCreator, int idleUDPSeconds)
public Map<String,Pair<io.netty.util.concurrent.EventExecutorGroup,io.netty.channel.ChannelHandler>> configureHandlers(io.netty.channel.SimpleChannelInboundHandler<Message> handler, FutureResponse futureResponse, int idleUDPSeconds, boolean isFireAndForget)
HolePunchInitiator and in the initHolePunch(...) method.handler - futureResponse - idleUDPSeconds - isFireAndForget - public void afterConnect(FutureResponse futureResponse, Message message, io.netty.channel.ChannelFuture channelFuture, boolean fireAndForget)
futureResponse - The future to set the responsemessage - The message to sendchannelFuture - the future of the connectfireAndForget - True, if we don't expect a messagepublic ConcurrentHashMap<Integer,FutureResponse> cachedRequests()
public List<PeerStatusListener> peerStatusListeners()
Copyright © 2015. All rights reserved.