internal static BackEndServer GetDeterministicBackEndServer <ServiceType>(BackEndServer mailboxServer, string identifier, ClientAccessType clientAccessType) where ServiceType : HttpService { if (mailboxServer == null) { throw new ArgumentNullException("mailboxServer"); } if (string.IsNullOrEmpty(identifier)) { throw new ArgumentNullException("identifier"); } if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Cafe.ServersCache.Enabled) { MiniServer deterministicBackEndServerFromSameSite = ServersCache.GetDeterministicBackEndServerFromSameSite(mailboxServer.Fqdn, Server.E15MinVersion, identifier, false); return(new BackEndServer(deterministicBackEndServerFromSameSite.Fqdn, deterministicBackEndServerFromSameSite.VersionNumber)); } HttpProxyBackEndHelper.TopologyWithSites completeServiceTopologyWithSites = HttpProxyBackEndHelper.GetCompleteServiceTopologyWithSites(mailboxServer.Fqdn); HttpService[] array = (HttpService[])HttpProxyBackEndHelper.FindAcceptableBackEndService <ServiceType>(completeServiceTopologyWithSites, clientAccessType, (int x) => x >= Server.E15MinVersion); if (array.Length > 0) { int num = HttpProxyBackEndHelper.ComputeIndex(identifier, array.Length); ExTraceGlobals.CafeTracer.TraceDebug <int, string, int>(0L, "[HttpProxyBackEndHelper.GetDeterministicBackEndServer] Buckets: {0} Identifier: {1} Index: {2}", array.Length, identifier, num); return(new BackEndServer(array[num].ServerFullyQualifiedDomainName, array[num].ServerVersionNumber)); } throw new ServerNotFoundException("Unable to find proper HTTP service."); }
// Token: 0x060005DF RID: 1503 RVA: 0x00020D48 File Offset: 0x0001EF48 private bool TryGetMiniServerFromPartitionId(string partitionId, out MiniServer server) { bool result; try { if (CafeConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).UseServerNameAsPartitionId.Enabled) { bool flag; server = ServersCache.GetServerOrDCByName(partitionId, ref flag); } else { Guid guid; if (!Guid.TryParse(partitionId, out guid)) { base.Logger.AppendGenericError("Get server by partitionID exception", "Not a GUID"); server = null; return(false); } bool flag; server = ServersCache.GetServerOrDCByObjectGuid(guid, ref flag); } result = true; } catch (ObjectNotFoundException ex) { base.Logger.AppendGenericError("Get server by partitionID exception", ex.ToString()); server = null; result = false; } return(result); }
public static int?LookupVersion(string server) { int versionNumber; if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Cafe.ServersCache.Enabled) { try { bool flag; MiniServer serverByFQDN = ServersCache.GetServerByFQDN(server, out flag); versionNumber = serverByFQDN.VersionNumber; goto IL_90; } catch (LocalServerNotFoundException) { return(null); } } ServiceTopology currentServiceTopology = ServiceTopology.GetCurrentServiceTopology("f:\\15.00.1497\\sources\\dev\\cafe\\src\\Common\\Misc\\ServerLookup.cs", "LookupVersion", 45); if (!currentServiceTopology.TryGetServerVersion(server, out versionNumber, "f:\\15.00.1497\\sources\\dev\\cafe\\src\\Common\\Misc\\ServerLookup.cs", "LookupVersion", 47)) { return(null); } IL_90: return(new int?(versionNumber)); }
internal static BackEndServer GetAnyBackEndServer(bool useServersCache) { if (useServersCache) { MiniServer anyBackEndServerWithMinVersion = ServersCache.GetAnyBackEndServerWithMinVersion(Server.E15MinVersion); return(new BackEndServer(anyBackEndServerWithMinVersion.Fqdn, anyBackEndServerWithMinVersion.VersionNumber)); } return(HttpProxyBackEndHelper.GetAnyBackEndServerForVersion <WebServicesService>(new ServerVersion(Server.E15MinVersion), false, ClientAccessType.InternalNLBBypass, false)); }
public static RemoteSiteInCurrentOrgTrackingAuthority Create(ADObjectId siteADObjectId, DirectoryContext directoryContext, int minServerVersionRequested, bool useServersCache) { string text = ServerCache.Instance.GetDefaultDomain(directoryContext.OrganizationId); int version = 0; Uri uri = null; if (useServersCache) { TraceWrapper.SearchLibraryTracer.TraceDebug <ADObjectId>(0, "Creating remote tracking authority via ServersCache for site: {0}", siteADObjectId); try { MiniServer anyBackEndServerFromASite = ServersCache.GetAnyBackEndServerFromASite(siteADObjectId, minServerVersionRequested, false); version = anyBackEndServerFromASite.VersionNumber; TraceWrapper.SearchLibraryTracer.TraceDebug <string, ServerVersion>(0, "Found remote server {0} running {1}.", anyBackEndServerFromASite.Fqdn, anyBackEndServerFromASite.AdminDisplayVersion); if (anyBackEndServerFromASite.MajorVersion >= 15) { BackEndServer backEndServer = new BackEndServer(anyBackEndServerFromASite.Fqdn, version); uri = BackEndLocator.GetBackEndWebServicesUrl(backEndServer); } else { TraceWrapper.SearchLibraryTracer.TraceDebug(0, "Server found was E14, finding new tracking authority via ServiceTopology.", new object[0]); uri = ServerCache.Instance.GetCasServerUri(siteADObjectId, minServerVersionRequested, out version); } goto IL_118; } catch (BackEndLocatorException ex) { TraceWrapper.SearchLibraryTracer.TraceError <string>(0, "Failed to acquire EWS URI from BackEndLocator with exception: {0}", ex.ToString()); TrackingFatalException.RaiseET(ErrorCode.CASUriDiscoveryFailure, siteADObjectId.ToString()); goto IL_118; } catch (ServerHasNotBeenFoundException ex2) { TraceWrapper.SearchLibraryTracer.TraceError <string>(0, "Failed to locate remote backend server from ServersCache with exception: {0}", ex2.ToString()); TrackingFatalException.RaiseET(ErrorCode.CASUriDiscoveryFailure, siteADObjectId.ToString()); goto IL_118; } } TraceWrapper.SearchLibraryTracer.TraceDebug(0, "Creating remote tracking authority via ServiceTopology.", new object[0]); uri = ServerCache.Instance.GetCasServerUri(siteADObjectId, minServerVersionRequested, out version); IL_118: if (null == uri) { TraceWrapper.SearchLibraryTracer.TraceError(0, "No suitable authority URI found.", new object[0]); TrackingFatalException.RaiseET(ErrorCode.CASUriDiscoveryFailure, siteADObjectId.ToString()); } return(new RemoteSiteInCurrentOrgTrackingAuthority(text, TrackingAuthorityKind.RemoteSiteInCurrentOrg, siteADObjectId, uri, version)); }
public override BackEndServer TryDirectBackEndCalculation() { if (this.ServerVersion.Major == 15 && !this.ExactVersionMatch) { BackEndServer backEndServer = LocalSiteMailboxServerCache.Instance.TryGetRandomE15Server(base.RequestContext); if (backEndServer != null) { ServerVersion serverVersion = new ServerVersion(backEndServer.Version); if (serverVersion.Minor >= this.ServerVersion.Minor) { return(backEndServer); } } } if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Cafe.ServersCache.Enabled) { try { MiniServer miniServer; if (this.ExactVersionMatch) { miniServer = ServersCache.GetAnyBackEndServerWithExactVersion(this.ServerVersion.ToInt()); } else { miniServer = ServersCache.GetAnyBackEndServerWithMinVersion(this.ServerVersion.ToInt()); } return(new BackEndServer(miniServer.Fqdn, miniServer.VersionNumber)); } catch (ServerHasNotBeenFoundException) { return(base.CheckForNullAndThrowIfApplicable <BackEndServer>(null)); } } BackEndServer result; try { BackEndServer anyBackEndServerForVersion = HttpProxyBackEndHelper.GetAnyBackEndServerForVersion <ServiceType>(this.ServerVersion, this.ExactVersionMatch, this.ClientAccessType, false); result = anyBackEndServerForVersion; } catch (ServerNotFoundException) { result = base.CheckForNullAndThrowIfApplicable <BackEndServer>(null); } return(result); }
// Token: 0x060005DE RID: 1502 RVA: 0x00020BB4 File Offset: 0x0001EDB4 protected override AnchorMailbox ResolveAnchorMailbox() { string text; if (!LogExportProxyHandler.TryGetPartitionId((from uriSegment in new Uri(new Uri("http://dummyHost", UriKind.Absolute), base.ClientRequest.Path).Segments where !uriSegment.Equals("/") select uriSegment).ToArray <string>(), out text)) { return(new AnonymousAnchorMailbox(this)); } MiniServer miniServer; if (!this.TryGetMiniServerFromPartitionId(text, out miniServer)) { throw new HttpException(404, string.Format("Unable to resolve server: {0}", text)); } if (miniServer.CurrentServerRole.HasFlag(2)) { return(new ServerInfoAnchorMailbox(new BackEndServer(miniServer.Fqdn, Server.E15MinVersion), this)); } MiniServer deterministicBackEndServerFromSameSite; try { deterministicBackEndServerFromSameSite = ServersCache.GetDeterministicBackEndServerFromSameSite(miniServer.Fqdn, 0, new Random().Next().ToString(), false); } catch (LocalServerNotFoundException ex) { base.Logger.AppendGenericError("GetDeterministicBackEndServerFromSameSite Exception", ex.ToString()); throw new HttpException(404, string.Format("Unable to resolve identity: {0}", miniServer.Fqdn)); } catch (ServerHasNotBeenFoundException ex2) { base.Logger.AppendGenericError("GetDeterministicBackEndServerFromSameSite Exception", ex2.ToString()); throw new HttpException(404, string.Format("No server available in site to service request: {0}", miniServer.Fqdn)); } if (deterministicBackEndServerFromSameSite == null) { throw new HttpException(404, string.Format("No server available in site to service request: {0}", miniServer.Fqdn)); } return(new ServerInfoAnchorMailbox(new BackEndServer(deterministicBackEndServerFromSameSite.Fqdn, Server.E15MinVersion), this)); }
public override BackEndServer TryDirectBackEndCalculation() { BackEndServer backEndServer = LocalSiteMailboxServerCache.Instance.TryGetRandomE15Server(base.RequestContext); if (backEndServer != null) { return(backEndServer); } if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Cafe.ServersCache.Enabled) { try { MiniServer anyBackEndServerFromLocalSite = ServersCache.GetAnyBackEndServerFromLocalSite(Server.E15MinVersion, false); return(new BackEndServer(anyBackEndServerFromLocalSite.Fqdn, anyBackEndServerFromLocalSite.VersionNumber)); } catch (ServerHasNotBeenFoundException) { return(base.CheckForNullAndThrowIfApplicable <BackEndServer>(null)); } } return(HttpProxyBackEndHelper.GetAnyBackEndServerForVersion <WebServicesService>(new ServerVersion(Server.E15MinVersion), false, ClientAccessType.InternalNLBBypass, true)); }