Skip to content

Commit 7da74a0

Browse files
feat(async-stream): add IGenericApi.Ping()
1 parent ddbbd12 commit 7da74a0

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

src/CoreApi/IGenericApi.cs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Runtime.CompilerServices;
34
using System.Text;
45
using System.Threading;
56
using System.Threading.Tasks;
@@ -114,5 +115,49 @@ Task<IEnumerable<PingResult>> PingAsync(
114115
int count = 10,
115116
CancellationToken cancel = default(CancellationToken)
116117
);
118+
119+
#if ASYNCSTREAM
120+
/// <summary>
121+
/// Send echo requests to a peer.
122+
/// </summary>
123+
/// <param name="peer">
124+
/// The peer ID to receive the echo requests.
125+
/// </param>
126+
/// <param name="count">
127+
/// The number of echo requests to send. Defaults to 10.
128+
/// </param>
129+
/// <param name="cancel">
130+
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
131+
/// </param>
132+
/// <returns>
133+
/// An asynchronous stream of <see cref="PingResult"/>.
134+
/// </returns>
135+
IAsyncEnumerable<PingResult> Ping(
136+
MultiHash peer,
137+
int count = 10,
138+
CancellationToken cancel = default
139+
);
140+
141+
/// <summary>
142+
/// Send echo requests to a peer.
143+
/// </summary>
144+
/// <param name="address">
145+
/// The address of a peer to receive the echo requests.
146+
/// </param>
147+
/// <param name="count">
148+
/// The number of echo requests to send. Defaults to 10.
149+
/// </param>
150+
/// <param name="cancel">
151+
/// Is used to stop the task. When cancelled, the <see cref="TaskCanceledException"/> is raised.
152+
/// </param>
153+
/// <returns>
154+
/// An asynchronous stream of <see cref="PingResult"/>.
155+
/// </returns>
156+
IAsyncEnumerable<PingResult> Ping(
157+
MultiAddress address,
158+
int count = 10,
159+
CancellationToken cancel = default
160+
);
161+
#endif
117162
}
118163
}

0 commit comments

Comments
 (0)