MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / updatePeers

Method updatePeers

sqlchain/runtime.go:241–259  ·  view source on GitHub ↗
(peers *proto.Peers)

Source from the content-addressed store, hash-verified

239}
240
241func (r *runtime) updatePeers(peers *proto.Peers) (err error) {
242 r.peersMutex.Lock()
243 defer r.peersMutex.Unlock()
244 index, found := peers.Find(r.server)
245
246 if found {
247 r.index = index
248 r.total = int32(len(peers.Servers))
249 r.peers = peers
250 r.server = peers.Servers[index]
251 } else {
252 // Just clear the server list, and the database instance should call chain.Stop() later
253 r.index = -1
254 r.total = 0
255 r.peers.Servers = r.peers.Servers[:0]
256 }
257
258 return
259}
260
261func (r *runtime) getIndex() int32 {
262 r.peersMutex.Lock()

Callers 1

UpdatePeersMethod · 0.80

Calls 1

FindMethod · 0.80

Tested by

no test coverage detected