예제 #1
0
func (self CoordinatorSlice) Chain() {
	for i, c := range self {
		if i < len(self)-1 {
			logflow.Printf("main", "Connect %d to %d locally", i, i+1)
			c.ConnectToLocal(self[i+1])
		}
		if i > 0 {
			logflow.Printf("main", "Connect %d to %d locally", i, i-1)
			c.ConnectToLocal(self[i-1])
		}
	}
}
예제 #2
0
func (self CoordinatorSlice) ChainTCP() {
	logflow.Println("main", "Exporting channels")
	for i, c := range self {
		if i < len(self)-1 {
			c.ExportRemote(i + 1)
		}
		if i > 0 {
			c.ExportRemote(i - 1)
		}
		c.RunExporterInitial()
	}
	logflow.Println("main", "Connecting coordinators")
	for i, c := range self {
		if i < len(self)-1 {
			logflow.Printf("main", "Connect %d to %d over TCP", i, i+1)
			c.ConnectToRPCServer(i+1, fmt.Sprintf("127.0.0.1:%d", 8000+i+1))
		}
		if i > 0 {
			logflow.Printf("main", "Connect %d to %d over TCP", i, i-1)
			c.ConnectToRPCServer(i-1, fmt.Sprintf("127.0.0.1:%d", 8000+i-1))
		}
	}
}