add mutex on StartCwtch and ReconnectCwtchForeground #54
16
lib.go
16
lib.go
|
@ -10,16 +10,15 @@ import (
|
||||||
"cwtch.im/cwtch/model"
|
"cwtch.im/cwtch/model"
|
||||||
"cwtch.im/cwtch/model/attr"
|
"cwtch.im/cwtch/model/attr"
|
||||||
"cwtch.im/cwtch/peer"
|
"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"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.openprivacy.ca/flutter/libcwtch-go/constants"
|
"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/flutter/libcwtch-go/utils"
|
||||||
|
"git.openprivacy.ca/openprivacy/connectivity"
|
||||||
|
"runtime"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"git.openprivacy.ca/openprivacy/connectivity/tor"
|
"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)
|
// 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
|
// Do need to re-send initial state tho, eg profiles that are already loaded
|
||||||
func ReconnectCwtchForeground() {
|
func ReconnectCwtchForeground() {
|
||||||
|
if application == nil {
|
||||||
|
log.Errorf("ReconnectCwtchForeground: Application is nil, presuming stale thread, EXITING Reconnect\n")
|
||||||
|
return
|
||||||
|
}
|
||||||
peerList := application.ListPeers()
|
peerList := application.ListPeers()
|
||||||
for onion := range peerList {
|
for onion := range peerList {
|
||||||
eventHandler.Push(event.NewEvent(event.NewPeer, map[event.Field]string{event.Identity: onion, event.Created: event.False}))
|
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
|
//export c_SendAppEvent
|
||||||
|
|
Loading…
Reference in New Issue