nwaku.go: GetNumConnectedPeers controls when passed pubsub is empty

This commit is contained in:
Ivan Folgueira Bande 2024-09-17 13:58:32 +02:00
parent 6954612f54
commit 8cf6cdcd27
No known key found for this signature in database
GPG Key ID: 3C117481F89E24A7
1 changed files with 8 additions and 1 deletions

View File

@ -2219,7 +2219,14 @@ func (self *NWaku) ListPeersInMesh(pubsubTopic string) (int, error) {
return 0, errors.New(errMsg)
}
func (self *NWaku) GetNumConnectedPeers(pubsubTopic string) (int, error) {
func (self *NWaku) GetNumConnectedPeers(paramPubsubTopic ...string) (int, error) {
var pubsubTopic string
if len(paramPubsubTopic) == 0 {
pubsubTopic = ""
} else {
pubsubTopic = paramPubsubTopic[0]
}
var resp = C.allocResp()
var cPubsubTopic = C.CString(pubsubTopic)
defer C.freeResp(resp)