func (self *MasterRPCClient) Connect() error { var err error self.lock.Lock() defer self.lock.Unlock() if self.conn == nil { self.conn, err = rpc.DialHTTP("tcp", config.MasterAddr()) } return err }
func initMasterRPC(done chan error) { server := rpc.NewServer() server.Register(new(MasterRPC)) l, err := net.Listen("tcp", ":"+config.MasterPort()) if err != nil { done <- err return } log.Printf(START_MSG, config.MasterAddr()) err = http.Serve(l, server) done <- err }