MCPcopy
hub / github.com/chaozh/MIT-6.824 / disconnect

Method disconnect

src/raft/config.go:328–348  ·  view source on GitHub ↗

detach server i from the net.

(i int)

Source from the content-addressed store, hash-verified

326
327// detach server i from the net.
328func (cfg *config) disconnect(i int) {
329 // fmt.Printf("disconnect(%d)\n", i)
330
331 cfg.connected[i] = false
332
333 // outgoing ClientEnds
334 for j := 0; j < cfg.n; j++ {
335 if cfg.endnames[i] != nil {
336 endname := cfg.endnames[i][j]
337 cfg.net.Enable(endname, false)
338 }
339 }
340
341 // incoming ClientEnds
342 for j := 0; j < cfg.n; j++ {
343 if cfg.endnames[j] != nil {
344 endname := cfg.endnames[j][i]
345 cfg.net.Enable(endname, false)
346 }
347 }
348}
349
350func (cfg *config) rpcCount(server int) int {
351 return cfg.net.GetCount(server)

Callers 13

crash1Method · 0.95
TestReElection2AFunction · 0.45
TestManyElections2AFunction · 0.45
TestFailAgree2BFunction · 0.45
TestFailNoAgree2BFunction · 0.45
TestRejoin2BFunction · 0.45
TestBackup2BFunction · 0.45
TestPersist12CFunction · 0.45
TestPersist22CFunction · 0.45
TestPersist32CFunction · 0.45
TestFigure8Unreliable2CFunction · 0.45
internalChurnFunction · 0.45

Calls 1

EnableMethod · 0.80

Tested by 12

TestReElection2AFunction · 0.36
TestManyElections2AFunction · 0.36
TestFailAgree2BFunction · 0.36
TestFailNoAgree2BFunction · 0.36
TestRejoin2BFunction · 0.36
TestBackup2BFunction · 0.36
TestPersist12CFunction · 0.36
TestPersist22CFunction · 0.36
TestPersist32CFunction · 0.36
TestFigure8Unreliable2CFunction · 0.36
internalChurnFunction · 0.36
snapcommonFunction · 0.36