func (s *Servers) GetServer(dsn string) (*Server, error) {
	s.m.Lock()
	defer s.m.Unlock()
	var err error
	var ok bool
	errCount := 0 // start at zero because we increment before doing work
	retries := 3
	var server *Server
	for {
		if errCount++; errCount > retries {
			return nil, err
		}
		server, ok = s.servers[dsn]
		if !ok {
			server, err = NewServer(dsn, s.opts...)
			if err != nil {
				time.Sleep(time.Duration(errCount) * time.Second)
				continue
			}
			s.servers[dsn] = server
		}
		if err = server.Ping(); err != nil {
			delete(s.servers, dsn)
			time.Sleep(time.Duration(errCount) * time.Second)
			continue
		}
		break
	}
	return server, nil
}
// GetServer returns established connection from a collection.
GetServer returns established connection from a collection.
// GetServer returns established connection from a collection .
func (s *Servers) GetServer(dsn string) (*Server, error) {
	s.m.Lock()
	defer s.m.Unlock()
	var err error
	var ok bool
	errCount := 0 
	retries := 3
	var server *Server
	for {
		if errCount++; errCount > retries {
			return nil, err
		}
		server, ok = s.servers[dsn]
		if !ok {
			server, err = NewServer(dsn, s.opts...)
			if err != nil {
				time.Sleep(time.Duration(errCount) * time.Second)
				continue
			}
			s.servers[dsn] = server
		}
		if err = server.Ping(); err != nil {
			delete(s.servers, dsn)
			time.Sleep(time.Duration(errCount) * time.Second)
			continue
		}
		break
	}
	return server, nil
}
func ( s * Servers ) GetServer ( dsn string ) ( * Server , error ) { s . m . Lock ( ) defer s . m . Unlock ( ) var err error var ok bool errCount := 0 retries := 3 var server * Server for { if errCount ++ ; errCount > retries { return nil , err } server , ok = s . servers [ dsn ] if ! ok { server , err = NewServer ( dsn , s . opts ... ) if err != nil { time . Sleep ( time . Duration ( errCount ) * time . Second ) continue } s . servers [ dsn ] = server } if err = server . Ping ( ) ; err != nil { delete ( s . servers , dsn ) time . Sleep ( time . Duration ( errCount ) * time . Second ) continue } break } return server , nil }
GetServer returns established connection from a collection.
GetServer returns established connection from a collection .
// start at zero because we increment before doing work