/// <summary>Get information about a domain socket path.</summary> /// <param name="addr">The inet address to use.</param> /// <param name="conf">The client configuration.</param> /// <returns>Information about the socket path.</returns> public virtual DomainSocketFactory.PathInfo GetPathInfo(IPEndPoint addr, DFSClient.Conf conf) { // If there is no domain socket path configured, we can't use domain // sockets. if (conf.GetDomainSocketPath().IsEmpty()) { return(DomainSocketFactory.PathInfo.NotConfigured); } // If we can't do anything with the domain socket, don't create it. if (!conf.IsDomainSocketDataTraffic() && (!conf.IsShortCircuitLocalReads() || conf .IsUseLegacyBlockReaderLocal())) { return(DomainSocketFactory.PathInfo.NotConfigured); } // If the DomainSocket code is not loaded, we can't create // DomainSocket objects. if (DomainSocket.GetLoadingFailureReason() != null) { return(DomainSocketFactory.PathInfo.NotConfigured); } // UNIX domain sockets can only be used to talk to local peers if (!DFSClient.IsLocalAddress(addr)) { return(DomainSocketFactory.PathInfo.NotConfigured); } string escapedPath = DomainSocket.GetEffectivePath(conf.GetDomainSocketPath(), addr .Port); DomainSocketFactory.PathState status = pathMap.GetIfPresent(escapedPath); if (status == null) { return(new DomainSocketFactory.PathInfo(escapedPath, DomainSocketFactory.PathState .Valid)); } else { return(new DomainSocketFactory.PathInfo(escapedPath, status)); } }
internal PathInfo(string path, DomainSocketFactory.PathState state) { this.path = path; this.state = state; }