Skip to content
This repository was archived by the owner on Nov 25, 2024. It is now read-only.

Commit b0d4d7c

Browse files
committed
bail out of the main sooner when testing
1 parent 2602355 commit b0d4d7c

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

contrib/dendrite-demo-i2p/main_i2p.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,14 @@ import (
4242
"github.com/matrix-org/dendrite/setup/config"
4343
)
4444

45-
var sam, err = goSam.NewClient(*samAddr)
45+
func client() (*goSam.Client, error) {
46+
if skip {
47+
return nil, nil
48+
}
49+
return goSam.NewClient(*samAddr)
50+
}
51+
52+
var sam, err = client()
4653

4754
// Dial a network connection to an I2P server or a unix socket. Fail for clearnet addresses.
4855
func Dial(network, addr string) (net.Conn, error) {

contrib/dendrite-demo-tor/main_tor.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,22 @@ import (
4040
"github.com/matrix-org/dendrite/setup/config"
4141
)
4242

43-
var t, terr = tor.Start(context.Background(), nil)
44-
var tdialer, tderr = t.Dialer(context.TODO(), nil)
43+
func start() (*tor.Tor, error) {
44+
if skip {
45+
return nil, nil
46+
}
47+
return tor.Start(context.Background(), nil)
48+
}
49+
50+
func dialer() (*tor.Dialer, error) {
51+
if skip {
52+
return nil, nil
53+
}
54+
return t.Dialer(context.TODO(), nil)
55+
}
56+
57+
var t, terr = start()
58+
var tdialer, tderr = dialer()
4559

4660
// Dial either a unix socket address, or connect to a remote address over Tor. Always uses Tor.
4761
func Dial(network, addr string) (net.Conn, error) {

0 commit comments

Comments
 (0)