func (g *Gun) Close() error {
	var errs []error
	for _, p := range g.peers() {
		if err := p.Close(); err != nil {
			errs = append(errs, err)
		}
	}
	g.serversCancelFn()
	if err := g.storage.Close(); err != nil {
		errs = append(errs, err)
	}
	if len(errs) == 0 {
		return nil
	} else if len(errs) == 1 {
		return errs[0]
	} else {
		return fmt.Errorf("Multiple errors: %v", errs)
	}
}
// Close stops all peers and servers and closes the underlying storage.
Close stops all peers and servers and closes the underlying storage.
// Close stops all peers and servers and closes the underlying storage .
func (g *Gun) Close() error {
	var errs []error
	for _, p := range g.peers() {
		if err := p.Close(); err != nil {
			errs = append(errs, err)
		}
	}
	g.serversCancelFn()
	if err := g.storage.Close(); err != nil {
		errs = append(errs, err)
	}
	if len(errs) == 0 {
		return nil
	} else if len(errs) == 1 {
		return errs[0]
	} else {
		return fmt.Errorf("Multiple errors: %v", errs)
	}
}
func ( g * Gun ) Close ( ) error { var errs [ ] error for _ , p := range g . peers ( ) { if err := p . Close ( ) ; err != nil { errs = append ( errs , err ) } } g . serversCancelFn ( ) if err := g . storage . Close ( ) ; err != nil { errs = append ( errs , err ) } if len ( errs ) == 0 { return nil } else if len ( errs ) == 1 { return errs [ 0 ] } else { return fmt . Errorf ( " " , errs ) } }
Close stops all peers and servers and closes the underlying storage.
Close stops all peers and servers and closes the underlying storage .