mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-06 22:43:10 -06:00
bail out of the main sooner when testing
This commit is contained in:
parent
2602355e2b
commit
b0d4d7c9a4
|
|
@ -42,7 +42,14 @@ import (
|
||||||
"github.com/matrix-org/dendrite/setup/config"
|
"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.
|
// Dial a network connection to an I2P server or a unix socket. Fail for clearnet addresses.
|
||||||
func Dial(network, addr string) (net.Conn, error) {
|
func Dial(network, addr string) (net.Conn, error) {
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,22 @@ import (
|
||||||
"github.com/matrix-org/dendrite/setup/config"
|
"github.com/matrix-org/dendrite/setup/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
var t, terr = tor.Start(context.Background(), nil)
|
func start() (*tor.Tor, error) {
|
||||||
var tdialer, tderr = t.Dialer(context.TODO(), nil)
|
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.
|
// 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) {
|
func Dial(network, addr string) (net.Conn, error) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue