mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-05-06 02:09:25 +00:00
adding CleanupReliabilityManager
This commit is contained in:
parent
de702d223a
commit
6235fb1876
@ -28,6 +28,9 @@ void* NewReliabilityManager(const char* channelId, SdsCallBack callback, void* u
|
||||
|
||||
void SetEventCallback(void* ctx, SdsCallBack callback, void* userData);
|
||||
|
||||
int CleanupReliabilityManager(void* ctx, SdsCallBack callback, void* userData);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -112,7 +112,7 @@ proc NewReliabilityManager(
|
||||
): pointer {.dynlib, exportc, cdecl.} =
|
||||
initializeLibrary()
|
||||
|
||||
## Creates a new instance of the WakuNode.
|
||||
## Creates a new instance of the Reliability Manager.
|
||||
if isNil(callback):
|
||||
echo "error: missing callback in NewReliabilityManager"
|
||||
return nil
|
||||
@ -147,5 +147,21 @@ proc SetEventCallback(
|
||||
ctx[].eventCallback = cast[pointer](callback)
|
||||
ctx[].eventUserData = userData
|
||||
|
||||
proc CleanupReliabilityManager(
|
||||
ctx: ptr SdsContext, callback: SdsCallBack, userData: pointer
|
||||
): cint {.dynlib, exportc.} =
|
||||
initializeLibrary()
|
||||
checkLibsdsParams(ctx, callback, userData)
|
||||
|
||||
sds_thread.destroySdsThread(ctx).isOkOr:
|
||||
let msg = "libsds error: " & $error
|
||||
callback(RET_ERR, unsafeAddr msg[0], cast[csize_t](len(msg)), userData)
|
||||
return RET_ERR
|
||||
|
||||
## always need to invoke the callback although we don't retrieve value to the caller
|
||||
callback(RET_OK, nil, 0, userData)
|
||||
|
||||
return RET_OK
|
||||
|
||||
### End of exported procs
|
||||
################################################################################
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user