private void ProcessUpdates()
{
+ Parallel.ForEach(_statusUpdateQueue.GetConsumingEnumerable(),
+ new ParallelOptions{MaxDegreeOfParallelism=1,CancellationToken=_cancellationToken},
+ action => action());
foreach (var action in _statusUpdateQueue.GetConsumingEnumerable())
{
action();
UserName = userName;
ApiKey = apiKey;
- if (UsePithos)
- {
- Token = ApiKey;
- string storageUrl = String.Format("{0}/{1}/{2}", AuthenticationUrl, VersionPath, UserName);
- StorageUrl = new Uri(storageUrl);
- }
- else
- {
- string authUrl = String.Format("{0}/{1}", AuthenticationUrl, VersionPath);
- var authClient = new PithosClient{BaseAddress= authUrl};
+ using (var authClient = new PithosClient{BaseAddress=AuthenticationUrl})
+ {
if (Proxy != null)
authClient.Proxy = new WebProxy(Proxy);
authClient.Headers.Add("X-Auth-User", UserName);
authClient.Headers.Add("X-Auth-Key", ApiKey);
- var response = authClient.DownloadStringWithRetry("",3);
+ authClient.DownloadStringWithRetry(VersionPath, 3);
authClient.AssertStatusOK("Authentication failed");
- string storageUrl = authClient.GetHeaderValue("X-Storage-Url");
+ var storageUrl = authClient.GetHeaderValue("X-Storage-Url");
if (String.IsNullOrWhiteSpace(storageUrl))
throw new InvalidOperationException("Failed to obtain storage url");
StorageUrl = new Uri(storageUrl);
-
+ UriBuilder b;
+ b.Scheme;
var token = authClient.GetHeaderValue("X-Auth-Token");
if (String.IsNullOrWhiteSpace(token))
throw new InvalidOperationException("Failed to obtain token url");
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{240B432F-1030-4623-BCC3-FF351D6C1B63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {240B432F-1030-4623-BCC3-FF351D6C1B63}.Debug|Any CPU.Build.0 = Debug|Any CPU
{240B432F-1030-4623-BCC3-FF351D6C1B63}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{240B432F-1030-4623-BCC3-FF351D6C1B63}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{240B432F-1030-4623-BCC3-FF351D6C1B63}.Debug|x86.ActiveCfg = Debug|Any CPU