From 9abece0f50fb95d09eaed3e54d40c34ccfb201b7 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Mon, 27 Feb 2023 12:07:19 -0800 Subject: [PATCH] Reorganize Peer Init --- app/app.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index 79ff14f..cfb3367 100644 --- a/app/app.go +++ b/app/app.go @@ -312,16 +312,20 @@ func (app *application) installProfile(profile peer.CwtchPeer) bool { if app.peers[profile.GetOnion()] == nil { eventBus := event.NewEventManager() app.eventBuses[profile.GetOnion()] = eventBus - app.registerHooks(profile) - profile.Init(app.eventBuses[profile.GetOnion()]) + + // Initialize the Peer with the Given Event Bus app.peers[profile.GetOnion()] = profile + profile.Init(app.eventBuses[profile.GetOnion()]) // Update the Peer with the Most Recent Experiment State... settings := app.settings.ReadGlobalSettings() profile.UpdateExperiments(settings.ExperimentsEnabled, settings.Experiments) + app.registerHooks(profile) + // Register the Peer With Application Plugins.. app.AddPeerPlugin(profile.GetOnion(), plugins.CONNECTIONRETRY) // Now Mandatory + // Finalize the Creation of Peer / Notify any Interfaces.. app.appBus.Publish(event.NewEvent(event.NewPeer, map[event.Field]string{event.Identity: profile.GetOnion(), event.Created: event.False})) return true }