attach server i to the net.
(i int)
| 303 | |
| 304 | // attach server i to the net. |
| 305 | func (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. |
| 328 | func (cfg *config) disconnect(i int) { |