Only launch 1 profile handling thread per profile (on reload)
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
b33c6c77dd
commit
6c5b48311d
2
lib.go
2
lib.go
|
@ -184,7 +184,7 @@ func ReconnectCwtchForeground() {
|
|||
// populate profile list
|
||||
peerList := application.ListPeers()
|
||||
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, "Reload": event.True}))
|
||||
}
|
||||
|
||||
for onion := range peerList {
|
||||
|
|
|
@ -78,7 +78,10 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
|
|||
onion := e.Data[event.Identity]
|
||||
profile := eh.app.GetPeer(e.Data[event.Identity])
|
||||
log.Debug("New Peer Event: %v", e)
|
||||
eh.startHandlingPeer(onion)
|
||||
|
||||
if e.Data["Reload"] != event.True {
|
||||
eh.startHandlingPeer(onion)
|
||||
}
|
||||
|
||||
if e.Data[event.Created] == event.True {
|
||||
name, _ := profile.GetAttribute(attr.GetLocalScope(constants.Name))
|
||||
|
@ -350,6 +353,7 @@ func (eh *EventHandler) startHandlingPeer(onion string) {
|
|||
}
|
||||
|
||||
func (eh *EventHandler) forwardProfileMessages(onion string, q event.Queue) {
|
||||
log.Infof("Launching Forwarding Goroutine for %v", onion)
|
||||
// TODO: graceful shutdown, via an injected event of special QUIT type exiting loop/go routine
|
||||
for {
|
||||
e := q.Next()
|
||||
|
|
Loading…
Reference in New Issue