Class RustDrasylChannel

java.lang.Object
io.netty.util.DefaultAttributeMap
io.netty.channel.AbstractChannel
org.drasyl.channel.rs.RustDrasylChannel
All Implemented Interfaces:
io.netty.channel.Channel, io.netty.channel.ChannelOutboundInvoker, io.netty.util.AttributeMap, Comparable<io.netty.channel.Channel>, DrasylChannel, IdentityChannel

@UnstableApi public class RustDrasylChannel extends io.netty.channel.AbstractChannel implements DrasylChannel
A virtual Channel for peer communication.

(Currently) only compatible with NioEventLoop.

Inspired by LocalChannel.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
     

    Nested classes/interfaces inherited from class io.netty.channel.AbstractChannel

    io.netty.channel.AbstractChannel.AbstractUnsafe

    Nested classes/interfaces inherited from interface io.netty.channel.Channel

    io.netty.channel.Channel.Unsafe
  • Method Summary

    Modifier and Type
    Method
    Description
    io.netty.channel.ChannelConfig
     
    protected void
     
    protected void
    doBind(SocketAddress localAddress)
     
    protected void
     
    protected void
     
    protected void
     
    protected void
    doWrite(io.netty.channel.ChannelOutboundBuffer in)
     
    protected Object
     
    void
    This method start processing (if any) queued inbound messages.
     
    boolean
     
    protected boolean
    isCompatible(io.netty.channel.EventLoop loop)
     
    boolean
     
    boolean
     
    boolean
    Returns true if and only if the total number of pending bytes exceed the read watermark of this channel.
    protected SocketAddress
     
    io.netty.channel.ChannelMetadata
     
    protected io.netty.channel.AbstractChannel.AbstractUnsafe
     
     
    void
    queueRead(io.netty.buffer.ByteBuf msg)
    This method places the message o in the queue for inbound messages to be read by this channel.
     
     

    Methods inherited from class io.netty.channel.AbstractChannel

    alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doDeregister, doShutdownOutput, equals, eventLoop, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, localAddress, maxMessagesPerWrite, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, pipeline, read, remoteAddress, toString, validateFileRegion, voidPromise, write, write, writeAndFlush, writeAndFlush

    Methods inherited from class io.netty.util.DefaultAttributeMap

    attr, hasAttr

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface io.netty.util.AttributeMap

    attr, hasAttr

    Methods inherited from interface io.netty.channel.Channel

    alloc, bytesBeforeUnwritable, bytesBeforeWritable, closeFuture, eventLoop, flush, id, isRegistered, isWritable, localAddress, pipeline, read, remoteAddress

    Methods inherited from interface io.netty.channel.ChannelOutboundInvoker

    bind, bind, close, close, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, voidPromise, write, write, writeAndFlush, writeAndFlush

    Methods inherited from interface java.lang.Comparable

    compareTo
  • Method Details

    • isDirectPathPresent

      public boolean isDirectPathPresent()
    • newUnsafe

      protected io.netty.channel.AbstractChannel.AbstractUnsafe newUnsafe()
      Specified by:
      newUnsafe in class io.netty.channel.AbstractChannel
    • isCompatible

      protected boolean isCompatible(io.netty.channel.EventLoop loop)
      Specified by:
      isCompatible in class io.netty.channel.AbstractChannel
    • identity

      public Identity identity()
      Specified by:
      identity in interface IdentityChannel
    • localAddress0

      protected SocketAddress localAddress0()
      Specified by:
      localAddress0 in class io.netty.channel.AbstractChannel
    • remoteAddress0

      public SocketAddress remoteAddress0()
      Specified by:
      remoteAddress0 in class io.netty.channel.AbstractChannel
    • doRegister

      protected void doRegister()
      Overrides:
      doRegister in class io.netty.channel.AbstractChannel
    • doBind

      protected void doBind(SocketAddress localAddress)
      Specified by:
      doBind in class io.netty.channel.AbstractChannel
    • doDisconnect

      protected void doDisconnect()
      Specified by:
      doDisconnect in class io.netty.channel.AbstractChannel
    • doClose

      protected void doClose()
      Specified by:
      doClose in class io.netty.channel.AbstractChannel
    • doBeginRead

      protected void doBeginRead()
      Specified by:
      doBeginRead in class io.netty.channel.AbstractChannel
    • unsafe

      Specified by:
      unsafe in interface io.netty.channel.Channel
      Overrides:
      unsafe in class io.netty.channel.AbstractChannel
    • queueRead

      public void queueRead(io.netty.buffer.ByteBuf msg)
      This method places the message o in the queue for inbound messages to be read by this channel. Queued messages are not processed until finishRead() is called.
    • finishRead

      public void finishRead()
      This method start processing (if any) queued inbound messages. This method ensures that read/write order is respected. Therefore, if channel is currently writing, these writes are performed first and the reads are performed afterwards.
    • parent

      public RustDrasylServerChannel parent()
      Specified by:
      parent in interface io.netty.channel.Channel
      Specified by:
      parent in interface DrasylChannel
      Overrides:
      parent in class io.netty.channel.AbstractChannel
    • doWrite

      protected void doWrite(io.netty.channel.ChannelOutboundBuffer in) throws Exception
      Specified by:
      doWrite in class io.netty.channel.AbstractChannel
      Throws:
      Exception
    • filterOutboundMessage

      protected Object filterOutboundMessage(Object msg) throws Exception
      Overrides:
      filterOutboundMessage in class io.netty.channel.AbstractChannel
      Throws:
      Exception
    • config

      public io.netty.channel.ChannelConfig config()
      Specified by:
      config in interface io.netty.channel.Channel
    • isOpen

      public boolean isOpen()
      Specified by:
      isOpen in interface io.netty.channel.Channel
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface io.netty.channel.Channel
    • metadata

      public io.netty.channel.ChannelMetadata metadata()
      Specified by:
      metadata in interface io.netty.channel.Channel
    • isReadBufferFull

      public boolean isReadBufferFull()
      Returns true if and only if the total number of pending bytes exceed the read watermark of this channel.