forked from cwtch.im/ui
call acn.Close so tor proceess is shut down
This commit is contained in:
parent
7609cc3d04
commit
a692a996ac
19
main.go
19
main.go
|
@ -56,8 +56,14 @@ func main() {
|
||||||
// this actually loads the qml
|
// this actually loads the qml
|
||||||
view.SetSource(qmlSource)
|
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
|
// 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.IncomingListener(gcd.UIState.AddMessage)
|
||||||
go characters.PostmanPat(gcd.OutgoingMessages)
|
go characters.PostmanPat(gcd.OutgoingMessages)
|
||||||
go characters.TorStatusPoller(gcd.TorStatus)
|
go characters.TorStatusPoller(gcd.TorStatus)
|
||||||
|
@ -83,6 +89,7 @@ func main() {
|
||||||
// here we go!
|
// here we go!
|
||||||
view.Show()
|
view.Show()
|
||||||
widgets.QApplication_Exec()
|
widgets.QApplication_Exec()
|
||||||
|
acn.Close()
|
||||||
}
|
}
|
||||||
|
|
||||||
// window construction boilerplate
|
// window construction boilerplate
|
||||||
|
@ -101,7 +108,7 @@ func initializeQtView() *quick.QQuickView {
|
||||||
|
|
||||||
// this is mostly going to get factored out when we add profile support
|
// 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
|
// 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
|
var err error
|
||||||
if os.Getenv("CWTCH_FOLDER") != "" {
|
if os.Getenv("CWTCH_FOLDER") != "" {
|
||||||
the.CwtchDir = os.Getenv("CWTCH_FOLDER")
|
the.CwtchDir = os.Getenv("CWTCH_FOLDER")
|
||||||
|
@ -122,13 +129,7 @@ func loadCwtchData(gcd *gothings.GrandCentralDispatcher) {
|
||||||
*/
|
*/
|
||||||
os.MkdirAll(the.CwtchDir, 0700)
|
os.MkdirAll(the.CwtchDir, 0700)
|
||||||
|
|
||||||
mn, err := connectivity.StartTor(the.CwtchDir, "")
|
the.CwtchApp = libapp.NewApp(acn, the.CwtchDir)
|
||||||
if err != nil {
|
|
||||||
log.Errorf("Could not start Tor: %v", err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
the.CwtchApp = libapp.NewApp(mn, the.CwtchDir)
|
|
||||||
|
|
||||||
err = the.CwtchApp.LoadProfiles("be gay do crime")
|
err = the.CwtchApp.LoadProfiles("be gay do crime")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue