C# Class Brunet.Tunnel.TunnelEdge

Holds the state information for a Tunnels.
Inheritance: System.Edge
Show file Open project: johnynek/brunet Class Usage Examples

Public Properties

Property Type Description
Header MemBlock
LocalID int

Protected Properties

Property Type Description
_ias IForwarderSelector
_local_ta TransportAddress
_mid MemBlock
_rand System.Random
_remote_id int
_remote_ta TransportAddress
_tunnels List

Public Methods

Method Description
DisconnectionHandler ( Connection con ) : void

We don't want to send on disconnected edges. So we remove said connections and edges!

ShouldClose ( ) : bool

We need to make sure we still have a way out of the tunnel maze, otherwise we could get an endless loop resulting in a stack exception. For now, we will simply ensure that one of our overlap or our overlaps overlap has at least one such connection. Furthermore, if we have a long chain of tunnels relying on one overlap, they will eventually all close after the top most peer which happens to be in their overlap closes.

TunnelEdge ( IEdgeSendHandler send_handler, Brunet.Tunnel.TunnelTransportAddress local_ta, Brunet.Tunnel.TunnelTransportAddress remote_ta, IForwarderSelector ias, List overlap ) : System

Outgoing edge, since we don't know the RemoteID yet!

TunnelEdge ( IEdgeSendHandler send_handler, Brunet.Tunnel.TunnelTransportAddress local_ta, Brunet.Tunnel.TunnelTransportAddress remote_ta, IForwarderSelector ias, List overlap, int remote_id ) : System

Constructor for a TunnelEdge, RemoteID == -1 for out bound.

UpdateNeighborIntersection ( List neighbors ) : void

When our tunnel peer has some state change, he notifies us and use that information to update our overlap, here we set the overlap.

Method Details

DisconnectionHandler() public method

We don't want to send on disconnected edges. So we remove said connections and edges!
public DisconnectionHandler ( Connection con ) : void
con Connection
return void

ShouldClose() public method

We need to make sure we still have a way out of the tunnel maze, otherwise we could get an endless loop resulting in a stack exception. For now, we will simply ensure that one of our overlap or our overlaps overlap has at least one such connection. Furthermore, if we have a long chain of tunnels relying on one overlap, they will eventually all close after the top most peer which happens to be in their overlap closes.
public ShouldClose ( ) : bool
return bool

TunnelEdge() public method

Outgoing edge, since we don't know the RemoteID yet!
public TunnelEdge ( IEdgeSendHandler send_handler, Brunet.Tunnel.TunnelTransportAddress local_ta, Brunet.Tunnel.TunnelTransportAddress remote_ta, IForwarderSelector ias, List overlap ) : System
send_handler IEdgeSendHandler
local_ta Brunet.Tunnel.TunnelTransportAddress
remote_ta Brunet.Tunnel.TunnelTransportAddress
ias IForwarderSelector
overlap List
return System

TunnelEdge() public method

Constructor for a TunnelEdge, RemoteID == -1 for out bound.
public TunnelEdge ( IEdgeSendHandler send_handler, Brunet.Tunnel.TunnelTransportAddress local_ta, Brunet.Tunnel.TunnelTransportAddress remote_ta, IForwarderSelector ias, List overlap, int remote_id ) : System
send_handler IEdgeSendHandler
local_ta Brunet.Tunnel.TunnelTransportAddress
remote_ta Brunet.Tunnel.TunnelTransportAddress
ias IForwarderSelector
overlap List
remote_id int
return System

UpdateNeighborIntersection() public method

When our tunnel peer has some state change, he notifies us and use that information to update our overlap, here we set the overlap.
public UpdateNeighborIntersection ( List neighbors ) : void
neighbors List
return void

Property Details

Header public property

public MemBlock Header
return MemBlock

LocalID public property

public int LocalID
return int

_ias protected property

protected IForwarderSelector _ias
return IForwarderSelector

_local_ta protected property

protected TransportAddress _local_ta
return TransportAddress

_mid protected property

protected MemBlock _mid
return MemBlock

_rand protected static property

protected static Random,System _rand
return System.Random

_remote_id protected property

protected int _remote_id
return int

_remote_ta protected property

protected TransportAddress _remote_ta
return TransportAddress

_tunnels protected property

A functional list of tunnels. Replace to update.
protected List _tunnels
return List