public static AddressManager GetAddrman(NodeBehaviorsCollection behaviors)
        {
            if (behaviors == null)
            {
                throw new ArgumentNullException("behaviors");
            }
            var behavior = behaviors.Find <AddressManagerBehavior>();

            if (behavior == null)
            {
                return(null);
            }
            return(behavior.AddressManager);
        }
        public static void SetAddrman(NodeBehaviorsCollection behaviors, AddressManager addrman)
        {
            if (behaviors == null)
            {
                throw new ArgumentNullException("behaviors");
            }
            var behavior = behaviors.Find <AddressManagerBehavior>();

            if (behavior == null)
            {
                // FIXME: Please take a look at this
                behavior = new AddressManagerBehavior(addrman);
                behaviors.Add(behavior);
            }
            behavior.AddressManager = addrman;
        }
 public static BroadcastHub GetBroadcastHub(NodeBehaviorsCollection behaviors)
 {
     return(Enumerable.OfType <BroadcastHubBehavior>(behaviors).Select(c => c.BroadcastHub).FirstOrDefault());
 }