コード例 #1
0
 /// <summary>
 /// Returns true if this zone has direct or indirect parent zone governor above it, optionally examining higher-level NOCs.
 /// If iAmZoneGovernor is true then this zone is skipped as the zone gov of this zone gov is not itself.
 /// </summary>
 public bool HasDirectOrIndirectParentZoneGovernor(SectionHost zgovHost, bool?iAmZoneGovernor = null, bool transcendNOC = false)
 {
     if (zgovHost == null)
     {
         return(false);
     }
     return(FindNearestParentZoneGovernors(iAmZoneGovernor, (sh) => sh.IsLogicallyTheSame(zgovHost), transcendNOC).Any());
 }
コード例 #2
0
ファイル: Metabank.ReslvNetSvc.cs プロジェクト: saleyn/agni
                              private NetSvcPeer resolveDynamicHostAddress(string fullHostName, string net, string svc, SectionHost fromh, SectionHost toh, NetSvcPeer toPeer)
                              {
                                  Contracts.HostInfo hinfo = null;

                                  SectionZone zone = toh.ParentZone;

                                  while (zone != null)
                                  {
                                      var hzgovs = zone.ZoneGovernorHosts.Where(h => !h.Dynamic);//Where for safeguard check, as dynamic host can not be zonegov, but in case someone ignores AMM error
                                      foreach (var hzgov in hzgovs)
                                      {
                                          try
                                          {
                                              using (var cl = Contracts.ServiceClientHub.New <Contracts.IZoneHostRegistryClient>(hzgov))
                                              {
                                                  cl.TimeoutMs = this.m_ResolveDynamicHostNetSvcTimeoutMs;
                                                  hinfo        = cl.GetSubordinateHost(fullHostName);
                                                  break;
                                              }
                                          }
                                          catch (Exception error)
                                          {
                                              //todo Perf counter
                                              log(MessageType.Error,
                                                  "resolveDynamicHostAddress()",
                                                  "Error resolving net svc on dynamic host '{0}' while contacting zgov on '{1}': {2}".Args(fullHostName, hzgov.RegionPath, error.ToMessageWithType()),
                                                  error);
                                          }
                                      } //foreach
                                      zone = zone.ParentZone; //loop only WITHIN the NOC
                                  }     //while

                                  if (hinfo == null)
                                  {
                                      throw new MetabaseException(StringConsts.METABASE_NET_SVC_RESOLVER_DYN_HOST_UNKNOWN_ERROR.Args(svc, fromh.RegionPath, toh.RegionPath, net));
                                  }

                                  var pattern = toPeer.Address + "*";

                                  foreach (var nic in hinfo.NetInfo.Adapters)
                                  {
                                      foreach (var addr in nic.Addresses.Where(a => a.Unicast))
                                      {
                                          if (NFX.Parsing.Utils.MatchPattern(addr.Name, pattern))
                                          {
                                              return(new NetSvcPeer(addr.Name, toPeer.Port, toPeer.Group));
                                          }
                                      }
                                  }

                                  throw new MetabaseException(StringConsts.METABASE_NET_SVC_RESOLVER_DYN_HOST_NO_ADDR_MATCH_ERROR.Args(svc, fromh.RegionPath, toh.RegionPath, net, toPeer.Address));
                              }
コード例 #3
0
                                      /// <summary>
                                      /// Returns true if this zone has direct or indirect parent zone governor above it, optionally examining higher-level NOCs.
                                      /// </summary>
                                      public bool HasDirectOrIndirectParentZoneGovernor(SectionHost zgovHost, bool?iAmZoneGovernor = null, bool transcendNOC = false)
                                      {
                                          var myZone = m_ParentZone;

                                          return(myZone.HasDirectOrIndirectParentZoneGovernor(zgovHost, iAmZoneGovernor, transcendNOC));
                                      }