Class PeerCommunicationWatcher
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelOutboundHandlerAdapter
-
- org.drasyl.peer.connection.handler.SimpleChannelOutboundHandler<ApplicationMessage>
-
- org.drasyl.peer.connection.handler.PeerCommunicationWatcher
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelOutboundHandler
public class PeerCommunicationWatcher extends SimpleChannelOutboundHandler<ApplicationMessage>
This handler informs when outgoing communication with other peers occurs. For this purpose,peerCommunicationConsumer
is called for eachApplicationMessage
that has been sent from the local node to other peers.
-
-
Field Summary
Fields Modifier and Type Field Description static String
PEER_COMMUNICATION_WATCHER
-
Constructor Summary
Constructors Constructor Description PeerCommunicationWatcher(CompressedPublicKey ownPublicKey, Consumer<CompressedPublicKey> peerCommunicationConsumer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
channelWrite0(io.netty.channel.ChannelHandlerContext ctx, ApplicationMessage msg, io.netty.channel.ChannelPromise promise)
Is called for each message of typeSimpleChannelOutboundHandler
on the outbound channel.-
Methods inherited from class org.drasyl.peer.connection.handler.SimpleChannelOutboundHandler
acceptOutboundMessage, write
-
Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter
bind, close, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, exceptionCaught, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
PEER_COMMUNICATION_WATCHER
public static final String PEER_COMMUNICATION_WATCHER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
PeerCommunicationWatcher
public PeerCommunicationWatcher(CompressedPublicKey ownPublicKey, Consumer<CompressedPublicKey> peerCommunicationConsumer)
-
-
Method Detail
-
channelWrite0
protected void channelWrite0(io.netty.channel.ChannelHandlerContext ctx, ApplicationMessage msg, io.netty.channel.ChannelPromise promise)
Description copied from class:SimpleChannelOutboundHandler
Is called for each message of typeSimpleChannelOutboundHandler
on the outbound channel.- Specified by:
channelWrite0
in classSimpleChannelOutboundHandler<ApplicationMessage>
- Parameters:
ctx
- theChannelHandlerContext
which thisSimpleChannelDuplexHandler
belongs tomsg
- the message to handlepromise
- the corresponding promise
-
-