Bail if Tor is already running too
This commit is contained in:
@ -71,6 +71,7 @@ func (m *Client) ServeHTTP(rw http.ResponseWriter, rq *http.Request) {
|
||||
|
||||
func (m *Client) Serve() error {
|
||||
//http.Handle("/", m)
|
||||
go m.TBS.RunTorWithLang()
|
||||
return http.ListenAndServe("127.0.0.1:7695", m)
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ package tbsupervise
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
@ -153,6 +154,10 @@ func (s *Supervisor) RunI2PBWithLang() error {
|
||||
}
|
||||
|
||||
func (s *Supervisor) torbail() error {
|
||||
_, err := net.Listen("TCP", "127.0.0.1:9050")
|
||||
if err != nil {
|
||||
return fmt.Errorf("Already running")
|
||||
}
|
||||
if s.torcmd != nil && s.torcmd.Process != nil && s.torcmd.ProcessState != nil {
|
||||
if s.torcmd.ProcessState.Exited() {
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user