Пример #1
0
func (plugin *BalancingPlugin) Stop() error {
	var errors golib.MultiError
	for _, server := range plugin.BackendServers {
		if err := server.Client.Close(); err != nil {
			errors = append(errors, fmt.Errorf("Error closing connection to %s: %v", server.Client, err))
		}
	}
	return errors.NilOrError()
}
Пример #2
0
func (session *PluginSession) cleanupPlugins() error {
	var errors golib.MultiError
	for _, plugin := range session.Plugins {
		if plugin != nil {
			if err := plugin.Cleanup(); err != nil {
				errors = append(errors, fmt.Errorf("Error stopping plugin session: %v", err))
			}
		}
	}
	return errors.NilOrError()
}
Пример #3
0
func (session *streamSession) Cleanup() {
	var errors golib.MultiError
	for _, p := range session.proxies() {
		if p.Err != nil {
			errors = append(errors, fmt.Errorf("Proxy %s error: %v", p, p.Err))
		}
	}
	if !session.backend.Success() {
		errors = append(errors, fmt.Errorf("%s", session.backend.StateString()))
	}
	session.CleanupErr = errors.NilOrError()
	if session.proxy.StreamStoppedCallback != nil {
		session.proxy.StreamStoppedCallback(session.backend, session.proxies())
	}
}
Пример #4
0
func (client *Client) Close() error {
	var err golib.MultiError
	client.pausedCond.L.Lock()
	defer client.pausedCond.L.Unlock()
	err.Add(client.Client.Close())
	client.resume(false)
	err.Add(client.lastErr)
	return err.NilOrError()
}
Пример #5
0
func (detector *HeartbeatFaultDetector) Close() error {
	var err golib.MultiError
	detector.Closed.Enable(func() {
		delete(detector.server.detectors, detector.token)
		// Notify remote server to stop sending heartbeats.
		if detector.Online() {
			err.Add(detector.client.ConfigureHeartbeat(detector.server.Server, 0, 0))
		}
		err.Add(detector.client.Close())
	})
	return err.NilOrError()
}
Пример #6
0
func (session *udpSession) Cleanup() {
	var errors golib.MultiError
	if session.udp.Err != nil {
		errors.Add(fmt.Errorf("UDP proxy %v error: %v", session.udp, session.udp.Err))
	}
	if session.udp2 != nil && session.udp2.Err != nil {
		errors.Add(fmt.Errorf("UDP proxy %v error: %v", session.udp2, session.udp2.Err))
	}
	session.CleanupErr = errors.NilOrError()
	if session.proxy.ProxyStoppedCallback != nil {
		session.proxy.ProxyStoppedCallback(session.udp)
		if session.udp2 != nil {
			session.proxy.ProxyStoppedCallback(session.udp2)
		}
	}
}
Пример #7
0
func (breaker *circuitBreaker) Close() error {
	var err golib.MultiError
	err.Add(breaker.client.Close())
	err.Add(breaker.FaultDetector.Close())
	return err.NilOrError()
}