C# Class Brunet.Relay.RelayEdgeListener

Relays provide the ability for disconnected peers to form via existing overlay connections. For example, two nodes behind asymmetric NATs can form a tunnel over a common peer forming a virtual direct link between each other. Relays provide a mechanism for forming a complete ring.
Inheritance: EdgeListener, IEdgeSendHandler, IDataHandler, IRpcHandler
Afficher le fichier Open project: pstjuste/brunet Class Usage Examples

Protected Properties

Свойство Type Description
_connections ConnectionList
_iasf IForwarderSelectorFactory
_ito IRelayOverlap
_local_tas IList
_node Brunet.Node
_oco OverlapConnectionOverlord
_oco_trim_timeout int
_oco_trim_timer FuzzyEvent
_running int
_started int

Private Properties

Свойство Type Description

Méthodes publiques

Méthode Description
CreateEdgeTo ( TransportAddress ta, EdgeCreationCallback ecb ) : void

Does not immediately create an edge to a remote node, instead, it tells a timer to wait 5 seconds prior to attempting an edge.

GetNearest ( Brunet.Address addr, ConnectionList cons ) : List

Returns our nearest neighbors to the specified address, which is in turn used to help communicate with tunnel peer.

HandleData ( MemBlock data, ISender return_path, object state ) : void

Where data packets prepended with a tunnel come. Here we receive data as well as create new RelayEdges.

HandleEdgeSend ( Edge from, ICopyable data ) : void

Used to send data over the tunnel via forwarding senders using a randomly selected peer from our overlap list.

HandleRpc ( ISender caller, string method, IList args, object rs ) : void
RelayEdgeListener ( Node node ) : Brunet
RelayEdgeListener ( Node node, IRelayOverlap ito ) : Brunet
RelayEdgeListener ( Node node, IRelayOverlap ito, IForwarderSelectorFactory iasf ) : Brunet
Start ( ) : void
Stop ( ) : void

Méthodes protégées

Méthode Description
AttemptToCreateOverlap ( RelayEdgeCallbackAction teca ) : void

First we try to find a third party we can connect with for overlap, if that is successful, we attempt to connect to him, if that is successful, we create a new tunnel edge.

CloseHandler ( object o, EventArgs ea ) : void

When a RelayEdge closes, we must remove it from our hashtable.

ConnectionHandler ( object o, EventArgs ea ) : void

We need to keep track of a current ConnectionList, so we listen to incoming connections. We also use this opportunity to rebuild our LocalTA.

CreateEdge ( RelayEdgeCallbackAction teca, List overlap ) : void

Common code to Create an outgoing edge.

CreateEdgeTo ( RelayEdgeCallbackAction teca ) : void

The delayed callback for CreateEdgeTo, we create an edge if there is a potential non-tunnel overlap and allow the Linker to do the rest.

DisconnectionHandler ( object o, EventArgs ea ) : void

When a disconnection occurs, we must make sure that none of our tunnels use that faulty edge / connection any more.

FailedEdgeCreate ( RelayEdgeCallbackAction teca ) : void

Common code to signify the failure of edge creation.

OcoTrim ( System.DateTime now ) : void

A callback to trim Overlapped Connections. We do this here, since we control Oco and he is essentially headless.

UpdateNeighborIntersection ( Brunet.Relay.RelayEdge from, IDictionary msg ) : void

Whenever the node receives a new StatusMessage from a tunnel, we use this to build a consisting of the intersection of our peers creating a table of potential tunneling options. We close the edge if it is empty.

Method Details

AttemptToCreateOverlap() protected méthode

First we try to find a third party we can connect with for overlap, if that is successful, we attempt to connect to him, if that is successful, we create a new tunnel edge.
protected AttemptToCreateOverlap ( RelayEdgeCallbackAction teca ) : void
teca RelayEdgeCallbackAction
Résultat void

CloseHandler() protected méthode

When a RelayEdge closes, we must remove it from our hashtable.
protected CloseHandler ( object o, EventArgs ea ) : void
o object
ea System.EventArgs
Résultat void

ConnectionHandler() protected méthode

We need to keep track of a current ConnectionList, so we listen to incoming connections. We also use this opportunity to rebuild our LocalTA.
protected ConnectionHandler ( object o, EventArgs ea ) : void
o object
ea System.EventArgs
Résultat void

CreateEdge() protected méthode

Common code to Create an outgoing edge.
protected CreateEdge ( RelayEdgeCallbackAction teca, List overlap ) : void
teca RelayEdgeCallbackAction
overlap List
Résultat void

CreateEdgeTo() protected méthode

The delayed callback for CreateEdgeTo, we create an edge if there is a potential non-tunnel overlap and allow the Linker to do the rest.
protected CreateEdgeTo ( RelayEdgeCallbackAction teca ) : void
teca RelayEdgeCallbackAction
Résultat void

CreateEdgeTo() public méthode

Does not immediately create an edge to a remote node, instead, it tells a timer to wait 5 seconds prior to attempting an edge.
public CreateEdgeTo ( TransportAddress ta, EdgeCreationCallback ecb ) : void
ta TransportAddress
ecb EdgeCreationCallback
Résultat void

DisconnectionHandler() protected méthode

When a disconnection occurs, we must make sure that none of our tunnels use that faulty edge / connection any more.
protected DisconnectionHandler ( object o, EventArgs ea ) : void
o object
ea System.EventArgs
Résultat void

FailedEdgeCreate() protected méthode

Common code to signify the failure of edge creation.
protected FailedEdgeCreate ( RelayEdgeCallbackAction teca ) : void
teca RelayEdgeCallbackAction
Résultat void

GetNearest() public static méthode

Returns our nearest neighbors to the specified address, which is in turn used to help communicate with tunnel peer.
public static GetNearest ( Brunet.Address addr, ConnectionList cons ) : List
addr Brunet.Address
cons ConnectionList
Résultat List

HandleData() public méthode

Where data packets prepended with a tunnel come. Here we receive data as well as create new RelayEdges.
public HandleData ( MemBlock data, ISender return_path, object state ) : void
data MemBlock
return_path ISender
state object
Résultat void

HandleEdgeSend() public méthode

Used to send data over the tunnel via forwarding senders using a randomly selected peer from our overlap list.
public HandleEdgeSend ( Edge from, ICopyable data ) : void
from Edge
data ICopyable
Résultat void

HandleRpc() public méthode

public HandleRpc ( ISender caller, string method, IList args, object rs ) : void
caller ISender
method string
args IList
rs object
Résultat void

OcoTrim() protected méthode

A callback to trim Overlapped Connections. We do this here, since we control Oco and he is essentially headless.
protected OcoTrim ( System.DateTime now ) : void
now System.DateTime
Résultat void

RelayEdgeListener() public méthode

public RelayEdgeListener ( Node node ) : Brunet
node Brunet.Node
Résultat Brunet

RelayEdgeListener() public méthode

public RelayEdgeListener ( Node node, IRelayOverlap ito ) : Brunet
node Brunet.Node
ito IRelayOverlap
Résultat Brunet

RelayEdgeListener() public méthode

public RelayEdgeListener ( Node node, IRelayOverlap ito, IForwarderSelectorFactory iasf ) : Brunet
node Brunet.Node
ito IRelayOverlap
iasf IForwarderSelectorFactory
Résultat Brunet

Start() public méthode

public Start ( ) : void
Résultat void

Stop() public méthode

public Stop ( ) : void
Résultat void

UpdateNeighborIntersection() protected méthode

Whenever the node receives a new StatusMessage from a tunnel, we use this to build a consisting of the intersection of our peers creating a table of potential tunneling options. We close the edge if it is empty.
protected UpdateNeighborIntersection ( Brunet.Relay.RelayEdge from, IDictionary msg ) : void
from Brunet.Relay.RelayEdge
msg IDictionary
Résultat void

Property Details

_connections protected_oe property

protected ConnectionList _connections
Résultat ConnectionList

_iasf protected_oe property

protected IForwarderSelectorFactory _iasf
Résultat IForwarderSelectorFactory

_ito protected_oe property

protected IRelayOverlap _ito
Résultat IRelayOverlap

_local_tas protected_oe property

protected IList _local_tas
Résultat IList

_node protected_oe property

protected Node,Brunet _node
Résultat Brunet.Node

_oco protected_oe property

protected OverlapConnectionOverlord,Brunet.Relay _oco
Résultat OverlapConnectionOverlord

_oco_trim_timeout protected_oe property

protected int _oco_trim_timeout
Résultat int

_oco_trim_timer protected_oe property

protected FuzzyEvent _oco_trim_timer
Résultat FuzzyEvent

_running protected_oe property

protected int _running
Résultat int

_started protected_oe property

protected int _started
Résultat int