Skip to content

Commit

Permalink
Merge pull request #972 from longfin/bugfix/969
Browse files Browse the repository at this point in the history
Fix errors on TurnClient
  • Loading branch information
earlbread authored Aug 28, 2020
2 parents 56981e4 + 1d78ed2 commit 6c4ecb0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ To be released.
when the target block does not exist in the chain. [[#941]]
- Fixed a bug that `Swarm<T>.StartAsync()` had not worked after `Swarm<T>.StopAsync()`
was once called. [[#965]]
- Fixed a bug that `TurnClient` had thrown `InvalidOperationException` when
reconnecting. [[#957], [#972]]

### CLI tools

Expand Down Expand Up @@ -285,11 +287,13 @@ To be released.
[#946]: https://github.com/planetarium/libplanet/pull/946
[#949]: https://github.com/planetarium/libplanet/pull/949
[#950]: https://github.com/planetarium/libplanet/pull/950
[#957]: https://github.com/planetarium/libplanet/issues/957
[#959]: https://github.com/planetarium/libplanet/issues/959
[#954]: https://github.com/planetarium/libplanet/pull/954
[#963]: https://github.com/planetarium/libplanet/pull/963
[#964]: https://github.com/planetarium/libplanet/pull/964
[#965]: https://github.com/planetarium/libplanet/pull/965
[#972]: https://github.com/planetarium/libplanet/pull/972
[sleep mode]: https://en.wikipedia.org/wiki/Sleep_mode


Expand Down
3 changes: 2 additions & 1 deletion Libplanet.Stun/Stun/TurnClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ private async Task ProcessMessage()
message.TransactionId,
out TaskCompletionSource<StunMessage> tcs))
{
tcs.SetResult(message);
// tcs may be already canceled.
tcs.TrySetResult(message);
}
}
catch (Exception e)
Expand Down
6 changes: 5 additions & 1 deletion Libplanet.Tests/Net/SwarmTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,11 @@ async Task MineAndBroadcast(CancellationToken cancellationToken)
cts.Cancel();
await Task.Delay(1000);

Assert.Equal(_blockchains[0].Tip, _blockchains[1].Tip);
Assert.NotEqual(_blockchains[1].Genesis, _blockchains[1].Tip);
Assert.Contains(
_blockchains[1].Tip.Hash,
_blockchains[0].BlockHashes
);
}
finally
{
Expand Down

0 comments on commit 6c4ecb0

Please sign in to comment.