From 803744dd291c15de810c05021e9b159ce7fdfedf Mon Sep 17 00:00:00 2001 From: Ivan Folgueira Bande Date: Thu, 11 Dec 2025 23:46:05 +0100 Subject: [PATCH] rm some Waku leftover references --- LICENSE | 2 +- ffi/ffi_context.nim | 19 +++++++++---------- ffi/ffi_thread_request.nim | 5 ++--- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/LICENSE b/LICENSE index 7cc520e..4873ffa 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2025 Waku +Copyright (c) 2025 Logos Messaging Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/ffi/ffi_context.nim b/ffi/ffi_context.nim index 491f135..699024b 100644 --- a/ffi/ffi_context.nim +++ b/ffi/ffi_context.nim @@ -69,19 +69,19 @@ proc sendRequestToFFIThread*( if fireSyncRes.get() == false: return err("Couldn't fireSync in time") - ## wait until the Waku Thread properly received the request + ## wait until the FFI working thread properly received the request let res = ctx.reqReceivedSignal.waitSync(timeout) if res.isErr(): return err("Couldn't receive reqReceivedSignal signal") - ## Notice that in case of "ok", the deallocShared(req) is performed by the Waku Thread in the - ## process proc. See the 'waku_thread_request.nim' module for more details. + ## Notice that in case of "ok", the deallocShared(req) is performed by the FFI Thread in the + ## process proc. ok() type Foo = object registerReqFFI(WatchdogReq, foo: ptr Foo): proc(): Future[Result[string, string]] {.async.} = - return ok("waku thread is not blocked") + return ok("FFI thread is not blocked") type JsonNotRespondingEvent = object eventType: string @@ -93,16 +93,15 @@ proc `$`(event: JsonNotRespondingEvent): string = $(%*event) proc onNotResponding*(ctx: ptr FFIContext) = - callEventCallback(ctx, "onWakuNotResponsive"): + callEventCallback(ctx, "onNotResponding"): $JsonNotRespondingEvent.init() proc watchdogThreadBody(ctx: ptr FFIContext) {.thread.} = - ## Watchdog thread that monitors the Waku thread and notifies the library user if it hangs. + ## Watchdog thread that monitors the FFI thread and notifies the library user if it hangs. let watchdogRun = proc(ctx: ptr FFIContext) {.async.} = const WatchdogStartDelay = 10.seconds const WatchdogTimeinterval = 1.seconds - const WakuNotRespondingTimeout = 3.seconds # Give time for the node to be created and up before sending watchdog requests await sleepAsync(WatchdogStartDelay) @@ -113,7 +112,7 @@ proc watchdogThreadBody(ctx: ptr FFIContext) {.thread.} = debug "Watchdog thread exiting because FFIContext is not running" break - let wakuCallback = proc( + let callback = proc( callerRet: cint, msg: ptr cchar, len: csize_t, userData: pointer ) {.cdecl, gcsafe, raises: [].} = discard ## Don't do anything. Just respecting the callback signature. @@ -121,7 +120,7 @@ proc watchdogThreadBody(ctx: ptr FFIContext) {.thread.} = trace "Sending watchdog request to FFI thread" - sendRequestToFFIThread(ctx, WatchdogReq.ffiNewReq(wakuCallback, nilUserData)).isOkOr: + sendRequestToFFIThread(ctx, WatchdogReq.ffiNewReq(callback, nilUserData)).isOkOr: error "Failed to send watchdog request to FFI thread", error = $error onNotResponding(ctx) @@ -174,7 +173,7 @@ proc createFFIContext*[T](): Result[ptr FFIContext[T], string] = createThread(ctx.ffiThread, ffiThreadBody[T], ctx) except ValueError, ResourceExhaustedError: freeShared(ctx) - return err("failed to create the Waku thread: " & getCurrentExceptionMsg()) + return err("failed to create the FFI thread: " & getCurrentExceptionMsg()) try: createThread(ctx.watchdogThread, watchdogThreadBody, ctx) diff --git a/ffi/ffi_thread_request.nim b/ffi/ffi_thread_request.nim index ee342e7..8ad25de 100644 --- a/ffi/ffi_thread_request.nim +++ b/ffi/ffi_thread_request.nim @@ -1,11 +1,10 @@ ## This file contains the base message request type that will be handled. ## The requests are created by the main thread and processed by -## the Waku Thread. +## the FFI Thread. import std/[json, macros], results, tables import chronos, chronos/threadsync import ./ffi_types, ./internal/ffi_macro, ./alloc, ./ffi_context -import waku/factory/waku type FFIThreadRequest* = object callback: FFICallBack @@ -42,7 +41,7 @@ proc handleRes[T: string | void]( if res.isErr(): foreignThreadGc: - let msg = "libwaku error: handleRes fireSyncRes error: " & $res.error + let msg = "ffi error: handleRes fireSyncRes error: " & $res.error request[].callback( RET_ERR, unsafeAddr msg[0], cast[csize_t](len(msg)), request[].userData )