コード例 #1
0
        public static AddressManager GetAddrman(NodeBehaviorsCollection behaviors)
        {
            if (behaviors == null)
            {
                throw new ArgumentNullException(nameof(behaviors));
            }
            var behavior = behaviors.Find <AddressManagerBehavior>();

            if (behavior == null)
            {
                return(null);
            }
            return(behavior.AddressManager);
        }
コード例 #2
0
        public static void SetAddrman(NodeBehaviorsCollection behaviors, AddressManager addrman)
        {
            if (behaviors == null)
            {
                throw new ArgumentNullException(nameof(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;
        }
コード例 #3
0
 public static BroadcastHub GetBroadcastHub(NodeBehaviorsCollection behaviors)
 {
     return(behaviors.OfType <BroadcastHubBehavior>().Select(c => c.BroadcastHub).FirstOrDefault());
 }