Merge branch 'cleanup-tor' of dan/ui into master

This commit is contained in:
erinn 2019-02-04 23:01:51 +00:00 committed by Gogs
commit abec1f205e
1 changed files with 10 additions and 9 deletions

19
main.go
View File

@ -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 {