diff --git a/lib.go b/lib.go index fa98476..291c991 100644 --- a/lib.go +++ b/lib.go @@ -10,16 +10,15 @@ import ( "cwtch.im/cwtch/model" "cwtch.im/cwtch/model/attr" "cwtch.im/cwtch/peer" - contact "git.openprivacy.ca/flutter/libcwtch-go/features/contacts" - "git.openprivacy.ca/flutter/libcwtch-go/features/groups" - "git.openprivacy.ca/openprivacy/connectivity" - "runtime" - "strings" - "encoding/json" "fmt" "git.openprivacy.ca/flutter/libcwtch-go/constants" + contact "git.openprivacy.ca/flutter/libcwtch-go/features/contacts" + "git.openprivacy.ca/flutter/libcwtch-go/features/groups" "git.openprivacy.ca/flutter/libcwtch-go/utils" + "git.openprivacy.ca/openprivacy/connectivity" + "runtime" + "strings" "encoding/base64" "git.openprivacy.ca/openprivacy/connectivity/tor" @@ -161,10 +160,15 @@ func c_ReconnectCwtchForeground() { // Like StartCwtch, but StartCwtch has already been called so we don't need to restart Tor etc (probably) // Do need to re-send initial state tho, eg profiles that are already loaded func ReconnectCwtchForeground() { + if application == nil { + log.Errorf("ReconnectCwtchForeground: Application is nil, presuming stale thread, EXITING Reconnect\n") + return + } peerList := application.ListPeers() for onion := range peerList { eventHandler.Push(event.NewEvent(event.NewPeer, map[event.Field]string{event.Identity: onion, event.Created: event.False})) } + application.GetPrimaryBus().Publish(event.NewEvent(utils.CwtchStarted, map[event.Field]string{})) } //export c_SendAppEvent