From a692a996ac904e3d098201be833d4d78d6bae338 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Mon, 4 Feb 2019 14:34:16 -0800 Subject: [PATCH] call acn.Close so tor proceess is shut down --- main.go | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index 0088ac8..f043c2b 100644 --- a/main.go +++ b/main.go @@ -56,8 +56,14 @@ func main() { // this actually loads the qml view.SetSource(qmlSource) + acn, err := connectivity.StartTor(the.CwtchDir, "") + if err != nil { + log.Errorf("Could not start Tor: %v", err) + os.Exit(1) + } + // these are long-lived pollers/listeners for incoming messages and status changes - loadCwtchData(gcd) + loadCwtchData(gcd, acn) go characters.IncomingListener(gcd.UIState.AddMessage) go characters.PostmanPat(gcd.OutgoingMessages) go characters.TorStatusPoller(gcd.TorStatus) @@ -83,6 +89,7 @@ func main() { // here we go! view.Show() widgets.QApplication_Exec() + acn.Close() } // window construction boilerplate @@ -101,7 +108,7 @@ func initializeQtView() *quick.QQuickView { // this is mostly going to get factored out when we add profile support // for now, it loads a single peer and fills the ui with its data -func loadCwtchData(gcd *gothings.GrandCentralDispatcher) { +func loadCwtchData(gcd *gothings.GrandCentralDispatcher, acn connectivity.ACN) { var err error if os.Getenv("CWTCH_FOLDER") != "" { the.CwtchDir = os.Getenv("CWTCH_FOLDER") @@ -122,13 +129,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) { */ os.MkdirAll(the.CwtchDir, 0700) - mn, err := connectivity.StartTor(the.CwtchDir, "") - if err != nil { - log.Errorf("Could not start Tor: %v", err) - os.Exit(1) - } - - the.CwtchApp = libapp.NewApp(mn, the.CwtchDir) + the.CwtchApp = libapp.NewApp(acn, the.CwtchDir) err = the.CwtchApp.LoadProfiles("be gay do crime") if err != nil {