Skip to content

Commit

Permalink
bail out of the main sooner when testing
Browse files Browse the repository at this point in the history
  • Loading branch information
eyedeekay committed Aug 21, 2024
1 parent 2602355 commit b0d4d7c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
9 changes: 8 additions & 1 deletion contrib/dendrite-demo-i2p/main_i2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
18 changes: 16 additions & 2 deletions contrib/dendrite-demo-tor/main_tor.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit b0d4d7c

Please sign in to comment.