libplanet icon indicating copy to clipboard operation
libplanet copied to clipboard

Exp/libp2p

Open greymistcube opened this issue 1 year ago • 0 comments

Leaving it as a draft for future reference. While working on this, I have run into several problems:

  • Related to dotnet-libp2p:
    • IRemotePeer.DialAsync<T>() is not properly cancellable. It is impossible to timeout with a CancellationToken.
    • The implementation of IServiceProvider uses several static variables to track services provided. Most notably, the instance of IProtocol is stored in a static HashSet<T>. A service of type T is retrieved only by its type, hence it is impossible to have several IServiceProviders for multiple ITransports for unit testing.
  • Related to libplanet:
    • The whole dotnet-libp2p stack is designed to have persistent connection between separate peers. That is, to continuously have a channel open with IRemotePeer obtained via ILocalPeer.DialAsync(). The issue may be with the underlying implementation of IServiceProvider on the dotnet-libp2p side, but regardless, parallel or subsequent calls to a same peer seem very unreliable.

greymistcube avatar Nov 25 '24 07:11 greymistcube