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

Method connect

src/raft/config.go:305–325  ·  view source on GitHub ↗

attach server i to the net.

(i int)

Source from the content-addressed store, hash-verified

303
304// attach server i to the net.
305func (cfg *config) connect(i int) {
306 // fmt.Printf("connect(%d)\n", i)
307
308 cfg.connected[i] = true
309
310 // outgoing ClientEnds
311 for j := 0; j < cfg.n; j++ {
312 if cfg.connected[j] {
313 endname := cfg.endnames[i][j]
314 cfg.net.Enable(endname, true)
315 }
316 }
317
318 // incoming ClientEnds
319 for j := 0; j < cfg.n; j++ {
320 if cfg.connected[j] {
321 endname := cfg.endnames[j][i]
322 cfg.net.Enable(endname, true)
323 }
324 }
325}
326
327// detach server i from the net.
328func (cfg *config) disconnect(i int) {

Callers 14

make_configFunction · 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
TestFigure82CFunction · 0.45
TestFigure8Unreliable2CFunction · 0.45

Calls 1

EnableMethod · 0.80

Tested by 13

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
TestFigure82CFunction · 0.36
TestFigure8Unreliable2CFunction · 0.36
internalChurnFunction · 0.36