Skip to content

Commit

Permalink
fix (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashuaidehao authored Nov 29, 2021
1 parent e99d099 commit 01db34e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/OracleService/Protocols/OracleNeoFSProtocol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void Dispose()
/// <param name="host">Client host.</param>
/// <param name="cancellation">Cancellation token object.</param>
/// <returns>Returns neofs object.</returns>
private Task<string> GetAsync(Uri uri, string host, CancellationToken cancellation)
private async Task<string> GetAsync(Uri uri, string host, CancellationToken cancellation)
{
string[] ps = uri.AbsolutePath.Split("/");
if (ps.Length < 2) throw new FormatException("Invalid neofs url");
Expand All @@ -75,14 +75,14 @@ private Task<string> GetAsync(Uri uri, string host, CancellationToken cancellati
var tokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellation);
tokenSource.CancelAfter(Settings.Default.NeoFS.Timeout);
if (ps.Length == 2)
return GetPayloadAsync(client, objectAddr, tokenSource.Token);
return ps[2] switch
return await GetPayloadAsync(client, objectAddr, tokenSource.Token);
return await (ps[2] switch
{
"range" => GetRangeAsync(client, objectAddr, ps.Skip(3).ToArray(), tokenSource.Token),
"header" => GetHeaderAsync(client, objectAddr, tokenSource.Token),
"hash" => GetHashAsync(client, objectAddr, ps.Skip(3).ToArray(), tokenSource.Token),
_ => throw new Exception("invalid command")
};
});
}

private static async Task<string> GetPayloadAsync(Client client, Address addr, CancellationToken cancellation)
Expand Down

0 comments on commit 01db34e

Please sign in to comment.