Reorganize Peer Init
This commit is contained in:
parent
05e77604d2
commit
9abece0f50
|
@ -312,16 +312,20 @@ func (app *application) installProfile(profile peer.CwtchPeer) bool {
|
||||||
if app.peers[profile.GetOnion()] == nil {
|
if app.peers[profile.GetOnion()] == nil {
|
||||||
eventBus := event.NewEventManager()
|
eventBus := event.NewEventManager()
|
||||||
app.eventBuses[profile.GetOnion()] = eventBus
|
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
|
app.peers[profile.GetOnion()] = profile
|
||||||
|
profile.Init(app.eventBuses[profile.GetOnion()])
|
||||||
|
|
||||||
// Update the Peer with the Most Recent Experiment State...
|
// Update the Peer with the Most Recent Experiment State...
|
||||||
settings := app.settings.ReadGlobalSettings()
|
settings := app.settings.ReadGlobalSettings()
|
||||||
profile.UpdateExperiments(settings.ExperimentsEnabled, settings.Experiments)
|
profile.UpdateExperiments(settings.ExperimentsEnabled, settings.Experiments)
|
||||||
|
app.registerHooks(profile)
|
||||||
|
|
||||||
|
// Register the Peer With Application Plugins..
|
||||||
app.AddPeerPlugin(profile.GetOnion(), plugins.CONNECTIONRETRY) // Now Mandatory
|
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}))
|
app.appBus.Publish(event.NewEvent(event.NewPeer, map[event.Field]string{event.Identity: profile.GetOnion(), event.Created: event.False}))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue