MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / printPeer

Method printPeer

IceFireDB-PubSub/pkg/ppubsub/pubsubStore.go:275–295  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

273}
274
275func (cr *PubSub) printPeer() {
276 ticker := time.NewTicker(1 * time.Second)
277 defer ticker.Stop()
278 peersAll := make(map[string]int)
279 for {
280 <-ticker.C
281 peers := cr.PeerList()
282 // Iterate over the list of peers
283 for _, p := range peers {
284 // Generate the pretty version of the peer ID
285 peerid := p.String()
286 // Add the peer ID to the peer box
287 if _, ok := peersAll[peerid]; ok {
288 peersAll[peerid]++
289 } else {
290 fmt.Println("New Peer:", peerid)
291 peersAll[peerid] = 0
292 }
293 }
294 }
295}
296
297// A method of PubSub that returns a list
298// of all peer IDs connected to it

Callers 1

JoinPubSubFunction · 0.95

Calls 2

PeerListMethod · 0.95
StringMethod · 0.65

Tested by

no test coverage detected