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); }
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; }
public static BroadcastHub GetBroadcastHub(NodeBehaviorsCollection behaviors) { return(behaviors.OfType <BroadcastHubBehavior>().Select(c => c.BroadcastHub).FirstOrDefault()); }