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 }