Expose Restart
the build failed Details

This commit is contained in:
Sarah Jamie Lewis 2019-11-06 11:29:44 -08:00
parent 94389db18e
commit c3451dd068
3 changed files with 14 additions and 11 deletions

View File

@ -28,8 +28,8 @@ type ACN interface {
// Sets the calback function to be called when ACN status changes // Sets the calback function to be called when ACN status changes
SetStatusCallback(callback func(int, string)) SetStatusCallback(callback func(int, string))
// Restarts the underlying connection // Restart the underlying connection
Reboot() Restart()
// Open takes a hostname and returns a net.conn to the derived endpoint // Open takes a hostname and returns a net.conn to the derived endpoint
// Open allows a client to resolve various hostnames to connections // Open allows a client to resolve various hostnames to connections

View File

@ -38,6 +38,10 @@ func (lp *localProvider) SetStatusCallback(callback func(int, string)) {
// nop // nop
} }
func (lp *localProvider) Restart() {
// noop
}
// WaitTillBootstrapped Blocks until underlying network is bootstrapped // WaitTillBootstrapped Blocks until underlying network is bootstrapped
func (lp *localProvider) WaitTillBootstrapped() { func (lp *localProvider) WaitTillBootstrapped() {
} }

View File

@ -121,7 +121,7 @@ func (tp *torProvider) Listen(identity PrivateKey, port int) (ListenService, err
case ed25519.PrivateKey: case ed25519.PrivateKey:
privkey = pk privkey = pk
gpubk := pk.Public() gpubk := pk.Public()
switch pubk := gpubk.(type) {git switch pubk := gpubk.(type) {
case ed25519.PublicKey: case ed25519.PublicKey:
onion = utils.GetTorV3Hostname(pubk) onion = utils.GetTorV3Hostname(pubk)
} }
@ -155,10 +155,6 @@ func (tp *torProvider) Listen(identity PrivateKey, port int) (ListenService, err
return ols, nil return ols, nil
} }
func (tp *torProvider) Reboot() {
tp.restart()
}
func (tp *torProvider) Open(hostname string) (net.Conn, string, error) { func (tp *torProvider) Open(hostname string) (net.Conn, string, error) {
tp.lock.Lock() tp.lock.Lock()
@ -178,6 +174,13 @@ func (tp *torProvider) Open(hostname string) (net.Conn, string, error) {
return conn, resolvedHostname, err return conn, resolvedHostname, err
} }
func (tp *torProvider) Restart() {
if tp.statusCallback != nil {
tp.statusCallback(0, "rebooting")
}
tp.restart()
}
func (tp *torProvider) Close() { func (tp *torProvider) Close() {
for _, child := range tp.childListeners { for _, child := range tp.childListeners {
child.Close() child.Close()
@ -289,9 +292,6 @@ func (tp *torProvider) monitorRestart() {
} }
} }
lastBootstrapProgress = prog lastBootstrapProgress = prog
tp.
case <-tp.breakChan: case <-tp.breakChan:
return return
} }
@ -331,7 +331,6 @@ func createFromExisting(controlport *control.Conn, datadir string) *tor.Tor {
StopProcessOnClose: false, StopProcessOnClose: false,
GeoIPCreatedFile: "", GeoIPCreatedFile: "",
GeoIPv6CreatedFile: "", GeoIPv6CreatedFile: "",
} }
t.Control.DebugWriter = t.DebugWriter t.Control.DebugWriter = t.DebugWriter