Example #1
0
func (m *Master) replaceTunnels(user, keyfile string, newAddrs []string) error {
	glog.Infof("replacing tunnels. New addrs: %v", newAddrs)
	tunnels := util.MakeSSHTunnels(user, keyfile, newAddrs)
	if err := tunnels.Open(); err != nil {
		return err
	}
	if m.tunnels != nil {
		m.tunnels.Close()
	}
	m.tunnels = tunnels
	return nil
}
Example #2
0
func (m *Master) replaceTunnels(user, keyfile string, newAddrs []string) error {
	glog.Infof("replacing tunnels. New addrs: %v", newAddrs)
	tunnels := util.MakeSSHTunnels(user, keyfile, newAddrs)
	if err := tunnels.Open(); err != nil {
		return err
	}
	m.tunnelsLock.Lock()
	defer m.tunnelsLock.Unlock()
	if m.tunnels != nil {
		m.tunnels.Close()
	}
	m.tunnels = tunnels
	atomic.StoreInt64(&m.lastSync, m.clock.Now().Unix())
	return nil
}