mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-06-27 21:09:28 +00:00
fix copilot suggestions
This commit is contained in:
parent
562c537ec7
commit
31b7d0902a
@ -225,7 +225,7 @@ extern "C"
|
||||
// This is a **temporary** API and will likely be gone by mainnet.
|
||||
//
|
||||
// The callback returns a string containing the previous value for
|
||||
// private queries ("true" if the were enabled, or "false" otherwise).
|
||||
// private queries ("true" if they were enabled, or "false" otherwise).
|
||||
int storage_toggle_private_queries(
|
||||
void *ctx,
|
||||
bool enabled,
|
||||
|
||||
@ -21,5 +21,8 @@ proc destroyShared(self: ptr NodeMixRequest) =
|
||||
proc process*(
|
||||
self: ptr NodeMixRequest, storage: ptr StorageServer
|
||||
): Future[Result[string, string]] {.async: (raises: []).} =
|
||||
defer:
|
||||
destroyShared(self)
|
||||
|
||||
let previous = storage[].node.togglePrivateQueries(self.privateQueries)
|
||||
return ok($previous)
|
||||
|
||||
@ -87,9 +87,9 @@ proc findPeer*(
|
||||
|
||||
return PeerRecord.none
|
||||
|
||||
method findViaMix(
|
||||
method findViaMix*(
|
||||
d: Discovery, cid: Cid
|
||||
): Future[?!seq[SignedPeerRecord]] {.async: (raises: [CancelledError]).} =
|
||||
): Future[?!seq[SignedPeerRecord]] {.base, async: (raises: [CancelledError]).} =
|
||||
var candidates = d.dhtMixProxies
|
||||
shuffle(candidates)
|
||||
|
||||
@ -105,7 +105,7 @@ method findViaMix(
|
||||
|
||||
method findDirect*(
|
||||
d: Discovery, cid: Cid
|
||||
): Future[?!seq[SignedPeerRecord]] {.async: (raises: [CancelledError]).} =
|
||||
): Future[?!seq[SignedPeerRecord]] {.base, async: (raises: [CancelledError]).} =
|
||||
try:
|
||||
return (await d.protocol.getProviders(cid.toNodeId())).mapFailure
|
||||
except CancelledError as exc:
|
||||
|
||||
@ -813,13 +813,14 @@ int check_toggle_private_queries(void *storage_ctx)
|
||||
}
|
||||
|
||||
int ret = is_resp_ok(r, &res);
|
||||
printf("B\n");
|
||||
if (strcmp(res, "false") != 0)
|
||||
{
|
||||
fprintf(stderr, "toggle private queries content mismatch, res:%s\n", res);
|
||||
free(res);
|
||||
return RET_ERR;
|
||||
}
|
||||
|
||||
free(res);
|
||||
// Second toggle is true -> false
|
||||
r = alloc_resp();
|
||||
if (storage_toggle_private_queries(storage_ctx, false, (StorageCallback)callback, r) != RET_OK)
|
||||
@ -832,9 +833,11 @@ int check_toggle_private_queries(void *storage_ctx)
|
||||
if (strcmp(res, "true") != 0)
|
||||
{
|
||||
fprintf(stderr, "toggle private queries content mismatch, res:%s\n", res);
|
||||
free(res);
|
||||
return RET_ERR;
|
||||
}
|
||||
|
||||
free(res);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user