bail out of the main sooner when testing

This commit is contained in:
eyedeekay 2024-08-21 17:37:01 -04:00
parent 2602355e2b
commit b0d4d7c9a4
No known key found for this signature in database
GPG key ID: D75C03B39B5E14E1
2 changed files with 24 additions and 3 deletions

View file

@ -42,7 +42,14 @@ import (
"github.com/matrix-org/dendrite/setup/config"
)
var sam, err = goSam.NewClient(*samAddr)
func client() (*goSam.Client, error) {
if skip {
return nil, nil
}
return goSam.NewClient(*samAddr)
}
var sam, err = client()
// Dial a network connection to an I2P server or a unix socket. Fail for clearnet addresses.
func Dial(network, addr string) (net.Conn, error) {

View file

@ -40,8 +40,22 @@ import (
"github.com/matrix-org/dendrite/setup/config"
)
var t, terr = tor.Start(context.Background(), nil)
var tdialer, tderr = t.Dialer(context.TODO(), nil)
func start() (*tor.Tor, error) {
if skip {
return nil, nil
}
return tor.Start(context.Background(), nil)
}
func dialer() (*tor.Dialer, error) {
if skip {
return nil, nil
}
return t.Dialer(context.TODO(), nil)
}
var t, terr = start()
var tdialer, tderr = dialer()
// Dial either a unix socket address, or connect to a remote address over Tor. Always uses Tor.
func Dial(network, addr string) (net.Conn, error) {