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 {
|
func (m *Client) Serve() error {
|
||||||
//http.Handle("/", m)
|
//http.Handle("/", m)
|
||||||
|
go m.TBS.RunTorWithLang()
|
||||||
return http.ListenAndServe("127.0.0.1:7695", m)
|
return http.ListenAndServe("127.0.0.1:7695", m)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package tbsupervise
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -153,6 +154,10 @@ func (s *Supervisor) RunI2PBWithLang() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Supervisor) torbail() 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 != nil && s.torcmd.Process != nil && s.torcmd.ProcessState != nil {
|
||||||
if s.torcmd.ProcessState.Exited() {
|
if s.torcmd.ProcessState.Exited() {
|
||||||
return nil
|
return nil
|
||||||
|
Reference in New Issue
Block a user