@@ -38,12 +38,12 @@ internal DhtApi(IpfsClient ipfs)
3838 /// Information about an IPFS peer.
3939 /// </summary>
4040 /// <param name="id">
41- /// The <see cref="string "/> ID of the IPFS peer.
41+ /// The <see cref="MultiHash "/> ID of the IPFS peer.
4242 /// </param>
4343 /// <param name="cancel">
4444 /// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
4545 /// </param>
46- public Task < Peer > FindPeerAsync ( string id , CancellationToken cancel = default ( CancellationToken ) )
46+ public Task < Peer > FindPeerAsync ( MultiHash id , CancellationToken cancel = default ( CancellationToken ) )
4747 {
4848 return ipfs . IdAsync ( id , cancel ) ;
4949 }
@@ -58,16 +58,15 @@ internal DhtApi(IpfsClient ipfs)
5858 /// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
5959 /// </param>
6060 /// <returns>
61- /// A sequence of IPFS peer IDs .
61+ /// A sequence of IPFS <see cref="Peer"/> .
6262 /// </returns>
63- public async Task < IEnumerable < string > > FindProvidersAsync ( string hash , CancellationToken cancel = default ( CancellationToken ) )
63+ public async Task < IEnumerable < Peer > > FindProvidersAsync ( string hash , CancellationToken cancel = default ( CancellationToken ) )
6464 {
65- var serializer = new JsonSerializer ( ) ;
6665 var stream = await ipfs . PostDownloadAsync ( "dht/findprovs" , cancel , hash ) ;
6766 return ProviderFromStream ( stream ) ;
6867 }
6968
70- IEnumerable < string > ProviderFromStream ( Stream stream )
69+ IEnumerable < Peer > ProviderFromStream ( Stream stream )
7170 {
7271 using ( var sr = new StreamReader ( stream ) )
7372 {
@@ -80,7 +79,7 @@ IEnumerable<string> ProviderFromStream(Stream stream)
8079 var r = JObject . Parse ( json ) ;
8180 var id = ( string ) r [ "ID" ] ;
8281 if ( id != String . Empty )
83- yield return id ;
82+ yield return new Peer { Id = new MultiHash ( id ) } ;
8483 else
8584 {
8685 var responses = ( JArray ) r [ "Responses" ] ;
@@ -89,7 +88,8 @@ IEnumerable<string> ProviderFromStream(Stream stream)
8988 foreach ( var response in responses )
9089 {
9190 var rid = ( string ) response [ "ID" ] ;
92- yield return rid ;
91+ if ( rid != String . Empty )
92+ yield return new Peer { Id = new MultiHash ( rid ) } ;
9393 }
9494 }
9595 }
0 commit comments