Merge branch 'master' of dan/libricochet-go into master

This commit is contained in:
Sarah Jamie Lewis 2019-02-04 22:19:53 +00:00 committed by Gogs
commit b3d6e0e019
1 changed files with 6 additions and 0 deletions

View File

@ -100,6 +100,10 @@ func (tp *torProvider) Listen(identity PrivateKey, port int) (ListenService, err
var onion = ""
var privkey ed25519.PrivateKey
if tp.t == nil {
return nil, errors.New("Tor Provider closed")
}
switch pk := identity.(type) {
case ed25519.PrivateKey:
privkey = pk
@ -147,6 +151,7 @@ func (tp *torProvider) Listen(identity PrivateKey, port int) (ListenService, err
func (tp *torProvider) Open(hostname string) (net.Conn, string, error) {
tp.lock.Lock()
defer tp.lock.Unlock()
if tp.t == nil {
return nil, hostname, errors.New("Tor is offline")
}
@ -180,6 +185,7 @@ func (tp *torProvider) Close() {
tp.breakChan <- true
if tp.t != nil {
tp.t.Close()
tp.t = nil
}
}