Skip to content

Commit 64bb550

Browse files
committed
fix example
1 parent 95a5e0b commit 64bb550

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

examples/custom-protocol.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,8 @@ impl ProtocolHandler for BlobSearch {
144144
///
145145
/// The returned future runs on a newly spawned tokio task, so it can run as long as
146146
/// the connection lasts.
147-
fn accept(self: Arc<Self>, connecting: Connecting) -> BoxedFuture<Result<()>> {
147+
fn accept(&self, connecting: Connecting) -> BoxedFuture<Result<()>> {
148+
let this = self.clone();
148149
// We have to return a boxed future from the handler.
149150
Box::pin(async move {
150151
// Wait for the connection to be fully established.
@@ -162,7 +163,7 @@ impl ProtocolHandler for BlobSearch {
162163

163164
// Now, we can perform the actual query on our local database.
164165
let query = String::from_utf8(query_bytes)?;
165-
let hashes = self.query_local(&query);
166+
let hashes = this.query_local(&query);
166167

167168
// We want to return a list of hashes. We do the simplest thing possible, and just send
168169
// one hash after the other. Because the hashes have a fixed size of 32 bytes, this is

0 commit comments

Comments
 (0)