fix: properly using waitgroup in num relay peers api (#23)

This commit is contained in:
gabrielmer 2025-02-03 19:09:16 +02:00 committed by GitHub
parent 44715d253e
commit c37577a160
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -596,7 +596,9 @@ func (n *WakuNode) GetNumConnectedRelayPeers(optPubsubTopic ...string) (int, err
var cPubsubTopic = C.CString(pubsubTopic)
defer C.free(unsafe.Pointer(cPubsubTopic))
wg.Add(1)
C.cGoWakuGetNumConnectedRelayPeers(n.wakuCtx, cPubsubTopic, resp)
wg.Wait()
if C.getRet(resp) == C.RET_OK {
numPeersStr := C.GoStringN(C.getMyCharPtr(resp), C.int(C.getMyCharLen(resp)))