mirror of
https://github.com/logos-messaging/nim-sds.git
synced 2026-01-02 14:13:07 +00:00
adding reset function
This commit is contained in:
parent
6235fb1876
commit
7609aa36b0
@ -30,6 +30,8 @@ void SetEventCallback(void* ctx, SdsCallBack callback, void* userData);
|
||||
|
||||
int CleanupReliabilityManager(void* ctx, SdsCallBack callback, void* userData);
|
||||
|
||||
int ResetReliabilityManager(void* ctx, SdsCallBack callback, void* userData);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@ -163,5 +163,17 @@ proc CleanupReliabilityManager(
|
||||
|
||||
return RET_OK
|
||||
|
||||
proc ResetReliabilityManager(
|
||||
ctx: ptr SdsContext, callback: SdsCallBack, userData: pointer
|
||||
): cint {.dynlib, exportc.} =
|
||||
checkLibsdsParams(ctx, callback, userData)
|
||||
handleRequest(
|
||||
ctx,
|
||||
RequestType.LIFECYCLE,
|
||||
SdsLifecycleRequest.createShared(SdsLifecycleMsgType.RESET_RELIABILITY_MANAGER),
|
||||
callback,
|
||||
userData,
|
||||
)
|
||||
|
||||
### End of exported procs
|
||||
################################################################################
|
||||
|
||||
@ -6,6 +6,7 @@ import ../../../../src/[reliability_utils, reliability, message]
|
||||
|
||||
type SdsLifecycleMsgType* = enum
|
||||
CREATE_RELIABILITY_MANAGER
|
||||
RESET_RELIABILITY_MANAGER
|
||||
|
||||
type SdsLifecycleRequest* = object
|
||||
operation: SdsLifecycleMsgType
|
||||
@ -58,5 +59,8 @@ proc process*(
|
||||
rm[] = (await createReliabilityManager(self.channelId)).valueOr:
|
||||
error "CREATE_RELIABILITY_MANAGER failed", error = error
|
||||
return err("error processing CREATE_RELIABILITY_MANAGER request: " & $error)
|
||||
of RESET_RELIABILITY_MANAGER:
|
||||
resetReliabilityManager(rm[]).isOkOr:
|
||||
return err("error processing RESET_RELIABILITY_MANAGER request: " & $error)
|
||||
|
||||
return ok("")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user