private KeyValuePair<Uri, Uri> GetNextPoolUri()
{
var i = this.urlIndex;
while (i < this.urls.Length)
{
var key = this.urls[i];
// check if the url is alive
if (this.statusPool[key])
{
try
{
// resolve the url
var resolved = realUrls[key] ?? this.uriConverter(this.client, key);
if (resolved != null)
{
if (log.IsDebugEnabled) log.Debug("Resolved pool url " + key + " to " + resolved);
return new KeyValuePair<Uri, Uri>(key, resolved);
}
}
catch (Exception e)
{
log.Error(e);
}
// ResolveUri threw an exception or returned null so mark this url as invalid
statusPool[key] = false;
log.Warn("Could not resolve url " + key + "; trying the next in the list");
}
i++;
}
return new KeyValuePair<Uri, Uri>();
}