/// <summary> /// Gets information about the remote host. /// Automatically creates and initializes a new instance of the HostInformation class when /// it is necessary. /// </summary> public HostInformation this[string uri] { get { lock (this.SyncRoot) { HostInformation hostInformation = this.Get(uri); if (hostInformation == null) { hostInformation = new HostInformation(uri, this.ITransportContext); this.UpdateHost(uri, hostInformation); // set a reasonable start up lifetime property value int expiration = GenuineUtility.ConvertToMilliseconds(this.ITransportContext.IParameterProvider[GenuineParameter.ConnectTimeout]); hostInformation.Renew(expiration, true); // LOG: BinaryLogWriter binaryLogWriter = GenuineLoggingServices.BinaryLogWriter; if (binaryLogWriter != null && binaryLogWriter[LogCategory.HostInformation] > 0) { binaryLogWriter.WriteEvent(LogCategory.HostInformation, "KnownHosts.this[string]", LogMessageType.HostInformationCreated, null, null, hostInformation, null, GenuineUtility.CurrentThreadId, Thread.CurrentThread.Name, null, null, -1, 0, 0, 0, null, null, null, null, "The HostInformation has been created for the remote host: {0}.", uri); } } return(hostInformation); } } }
/// <summary> /// Renews the host information. /// </summary> /// <param name="uriOrUrl">Uri or Url of the remote host.</param> /// <param name="timeSpan">The time period specified in milliseconds to renew host-related information.</param> /// <param name="canMakeShorter">Indicates whether this call may reduce the host expiration time.</param> public void Renew(string uriOrUrl, int timeSpan, bool canMakeShorter) { HostInformation hostInformation = null; hostInformation = this.Get(uriOrUrl); if (hostInformation != null) { hostInformation.Renew(timeSpan, canMakeShorter); } }
/// <summary> /// Gets information about the remote host. /// Automatically creates and initializes a new instance of the HostInformation class when /// it is necessary. /// </summary> public HostInformation this[string uri] { get { lock (this.SyncRoot) { HostInformation hostInformation = this.Get(uri); if (hostInformation == null) { hostInformation = new HostInformation(uri, this.ITransportContext); this.UpdateHost(uri, hostInformation); // set a reasonable start up lifetime property value int expiration = GenuineUtility.ConvertToMilliseconds(this.ITransportContext.IParameterProvider[GenuineParameter.ConnectTimeout]); hostInformation.Renew(expiration, true); // LOG: BinaryLogWriter binaryLogWriter = GenuineLoggingServices.BinaryLogWriter; if ( binaryLogWriter != null && binaryLogWriter[LogCategory.HostInformation] > 0 ) binaryLogWriter.WriteEvent(LogCategory.HostInformation, "KnownHosts.this[string]", LogMessageType.HostInformationCreated, null, null, hostInformation, null, GenuineUtility.CurrentThreadId, Thread.CurrentThread.Name, null, null, -1, 0, 0, 0, null, null, null, null, "The HostInformation has been created for the remote host: {0}.", uri); } return hostInformation; } } }