Skip to content

Commit

Permalink
fix: better sync code #19
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider committed May 3, 2019
1 parent ad4e78c commit bb32760
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Multiplex/Substream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void NoMoreData()
/// <inheritdoc />
public override int Read(byte[] buffer, int offset, int count)
{
return ReadAsync(buffer, offset, count).Result;
return ReadAsync(buffer, offset, count).GetAwaiter().GetResult();
}

/// <inheritdoc />
Expand Down Expand Up @@ -164,7 +164,7 @@ public override async Task<int> ReadAsync(byte[] buffer, int offset, int count,
/// <inheritdoc />
public override void Flush()
{
FlushAsync().Wait();
FlushAsync().GetAwaiter().GetResult();
}

/// <inheritdoc />
Expand Down
4 changes: 2 additions & 2 deletions src/SecureCommunication/Secio1Stream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public override void SetLength(long value)
/// <inheritdoc />
public override int Read(byte[] buffer, int offset, int count)
{
return ReadAsync(buffer, offset, count).Result;
return ReadAsync(buffer, offset, count).GetAwaiter().GetResult();
}

/// <inheritdoc />
Expand Down Expand Up @@ -202,7 +202,7 @@ async Task<byte[]> ReadPacketBytesAsync(int count, CancellationToken cancel)
/// <inheritdoc />
public override void Flush()
{
FlushAsync().Wait();
FlushAsync().GetAwaiter().GetResult();
}

/// <inheritdoc />
Expand Down
4 changes: 2 additions & 2 deletions src/Transports/DatagramStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected override void Dispose(bool disposing)

public override void Flush()
{
FlushAsync().Wait();
FlushAsync().GetAwaiter().GetResult();
}

public override async Task FlushAsync(CancellationToken cancellationToken)
Expand All @@ -81,7 +81,7 @@ public override async Task FlushAsync(CancellationToken cancellationToken)

public override int Read(byte[] buffer, int offset, int count)
{
return ReadAsync(buffer, offset, count).Result;
return ReadAsync(buffer, offset, count).GetAwaiter().GetResult();
}

public override async Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
Expand Down

0 comments on commit bb32760

Please sign in to comment.