Class

org.bitcoins.node.networking

P2PClientActor

Related Doc: package networking

Permalink

case class P2PClientActor(peer: Peer, initPeerMsgHandlerReceiver: PeerMessageReceiver)(implicit config: NodeAppConfig) extends Actor with P2PLogger with Product with Serializable

This actor is responsible for creating a connection, relaying messages and closing a connection to our peer on the P2P network. This is the actor that directly interacts with the p2p network. It's responsibly is to deal with low level .TCP messages.

If the client receives a NetworkMessage, from a PeerMessageSender it serializes the message to it to a akka.util.ByteString and then sends it to the internal manager which streams the data to our peer on the Bitcoin network.

If the client receives a Tcp.Received message, it means we have received a message from our peer on the Bitcoin P2P network. This means we try to parse the bytes into a NetworkMessage. If we successfully parse the message we relay that message to the PeerMessageSender that created the Client Actor.

In this class you will see a 'unalignedBytes' value passed around in a lot of methods. This is because we cannot assume that a Bitcoin P2P message aligns with a TCP packet. For instance, a large block message (up to 4MB in size) CANNOT fit in a single TCP packet. This means we must cache the bytes and wait for the rest of them to be sent.

initPeerMsgHandlerReceiver

The place we send messages that we successfully parsed from our peer on the P2P network. This is mostly likely a org.bitcoins.node.networking.peer.PeerMessageSender

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. P2PClientActor
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. P2PLogger
  7. Actor
  8. AnyRef
  9. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new P2PClientActor(peer: Peer, initPeerMsgHandlerReceiver: PeerMessageReceiver)(implicit config: NodeAppConfig)

    Permalink

    initPeerMsgHandlerReceiver

    The place we send messages that we successfully parsed from our peer on the P2P network. This is mostly likely a org.bitcoins.node.networking.peer.PeerMessageSender

Type Members

  1. type Receive = PartialFunction[Any, Unit]

    Permalink
    Definition Classes
    Actor

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def aroundPostRestart(reason: Throwable): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Actor
    Annotations
    @InternalApi()
  5. def aroundPostStop(): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Actor
    Annotations
    @InternalApi()
  6. def aroundPreRestart(reason: Throwable, message: Option[Any]): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Actor
    Annotations
    @InternalApi()
  7. def aroundPreStart(): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Actor
    Annotations
    @InternalApi()
  8. def aroundReceive(receive: akka.actor.Actor.Receive, msg: Any): Unit

    Permalink
    Attributes
    protected[akka]
    Definition Classes
    Actor
    Annotations
    @InternalApi()
  9. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  10. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  11. implicit val context: ActorContext

    Permalink
    Definition Classes
    Actor
  12. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  13. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. val initPeerMsgHandlerReceiver: PeerMessageReceiver

    Permalink

    The place we send messages that we successfully parsed from our peer on the P2P network.

    The place we send messages that we successfully parsed from our peer on the P2P network. This is mostly likely a org.bitcoins.node.networking.peer.PeerMessageSender

  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. def logger(implicit config: NodeAppConfig): MarkedLogger

    Permalink
    Attributes
    protected
    Definition Classes
    P2PLogger
  18. def manager: ActorRef

    Permalink

    The manager is an actor that handles the underlying low level I/O resources (selectors, channels) and instantiates workers for specific tasks, such as listening to incoming connections.

  19. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  20. val network: NetworkParameters

    Permalink

    The parameters for the network we are connected to

  21. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  22. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  23. val peer: Peer

    Permalink
  24. def postRestart(reason: Throwable): Unit

    Permalink
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  25. def postStop(): Unit

    Permalink
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  26. def preRestart(reason: Throwable, message: Option[Any]): Unit

    Permalink
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  27. def preStart(): Unit

    Permalink
    Definition Classes
    Actor
    Annotations
    @throws( classOf[java.lang.Exception] )
  28. def receive: Receive

    Permalink

    This context is responsible for initializing a tcp connection with a peer on the bitcoin p2p network

    This context is responsible for initializing a tcp connection with a peer on the bitcoin p2p network

    Definition Classes
    P2PClientActor → Actor
  29. implicit final val self: ActorRef

    Permalink
    Definition Classes
    Actor
  30. final def sender(): ActorRef

    Permalink
    Definition Classes
    Actor
  31. def supervisorStrategy: SupervisorStrategy

    Permalink
    Definition Classes
    Actor
  32. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  33. def unhandled(message: Any): Unit

    Permalink
    Definition Classes
    Actor
  34. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  35. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  36. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from P2PLogger

Inherited from Actor

Inherited from AnyRef

Inherited from Any

Ungrouped