예제 #1
0
func (s *Svc) ClientStatus() map[string]bool {
	s.mut.RLock()
	status := make(map[string]bool, len(s.clients))
	for uri, client := range s.clients {
		status[uri] = client.StatusOK()
	}
	s.mut.RUnlock()
	return status
}
예제 #2
0
파일: relay.go 프로젝트: vicctor/syncthing
func (s *Svc) ClientStatus() map[string]bool {
	if s == nil {
		// A nil client does not have a status, really. Yet we may be called
		// this way, for raisins...
		return nil
	}

	s.mut.RLock()
	status := make(map[string]bool, len(s.clients))
	for uri, client := range s.clients {
		status[uri] = client.StatusOK()
	}
	s.mut.RUnlock()
	return status
}
예제 #3
0
파일: relay.go 프로젝트: jemmy655/syncthing
// RelayStatus returns the latency and OK status for a given relay.
func (s *Svc) RelayStatus(uri string) (time.Duration, bool) {
	if s == nil {
		// A nil client does not have a status, really. Yet we may be called
		// this way, for raisins...
		return time.Hour, false
	}

	s.mut.RLock()
	client, ok := s.clients[uri]
	s.mut.RUnlock()

	if !ok || !client.StatusOK() {
		return time.Hour, false
	}

	return client.Latency(), true
}