mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-07 16:33:08 +00:00
chore: exposing online state in libwaku (#3433)
This commit is contained in:
parent
ee5932ebc5
commit
e7f5c8cb23
@ -232,6 +232,10 @@ int waku_ping_peer(void* ctx,
|
|||||||
WakuCallBack callback,
|
WakuCallBack callback,
|
||||||
void* userData);
|
void* userData);
|
||||||
|
|
||||||
|
int waku_is_online(void* ctx,
|
||||||
|
WakuCallBack callback,
|
||||||
|
void* userData);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -842,5 +842,19 @@ proc waku_ping_peer(
|
|||||||
userData,
|
userData,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
proc waku_is_online(
|
||||||
|
ctx: ptr WakuContext, callback: WakuCallBack, userData: pointer
|
||||||
|
): cint {.dynlib, exportc.} =
|
||||||
|
initializeLibrary()
|
||||||
|
checkLibwakuParams(ctx, callback, userData)
|
||||||
|
|
||||||
|
handleRequest(
|
||||||
|
ctx,
|
||||||
|
RequestType.PEER_MANAGER,
|
||||||
|
PeerManagementRequest.createShared(PeerManagementMsgType.IS_ONLINE),
|
||||||
|
callback,
|
||||||
|
userData,
|
||||||
|
)
|
||||||
|
|
||||||
### End of exported procs
|
### End of exported procs
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|||||||
@ -15,6 +15,7 @@ type PeerManagementMsgType* {.pure.} = enum
|
|||||||
DIAL_PEER
|
DIAL_PEER
|
||||||
DIAL_PEER_BY_ID
|
DIAL_PEER_BY_ID
|
||||||
GET_CONNECTED_PEERS
|
GET_CONNECTED_PEERS
|
||||||
|
IS_ONLINE
|
||||||
|
|
||||||
type PeerManagementRequest* = object
|
type PeerManagementRequest* = object
|
||||||
operation: PeerManagementMsgType
|
operation: PeerManagementMsgType
|
||||||
@ -144,5 +145,7 @@ proc process*(
|
|||||||
(inPeerIds, outPeerIds) = waku.node.peerManager.connectedPeers()
|
(inPeerIds, outPeerIds) = waku.node.peerManager.connectedPeers()
|
||||||
connectedPeerids = concat(inPeerIds, outPeerIds)
|
connectedPeerids = concat(inPeerIds, outPeerIds)
|
||||||
return ok(connectedPeerids.mapIt($it).join(","))
|
return ok(connectedPeerids.mapIt($it).join(","))
|
||||||
|
of IS_ONLINE:
|
||||||
|
return ok($waku.node.peerManager.isOnline())
|
||||||
|
|
||||||
return ok("")
|
return ok("")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user