make ActivatePeerEngine safe to recall
This commit is contained in:
parent
06d402c4d7
commit
bdb4b93f59
|
@ -282,7 +282,9 @@ func (app *application) ActivateEngines(doListen, doPeers, doServers bool) {
|
||||||
func (app *application) ActivatePeerEngine(onion string, doListen, doPeers, doServers bool) {
|
func (app *application) ActivatePeerEngine(onion string, doListen, doPeers, doServers bool) {
|
||||||
profile := app.GetPeer(onion)
|
profile := app.GetPeer(onion)
|
||||||
if profile != nil {
|
if profile != nil {
|
||||||
|
if _, exists := app.engines[onion]; !exists {
|
||||||
app.engines[profile.GetOnion()], _ = profile.GenerateProtocolEngine(app.acn, app.eventBuses[profile.GetOnion()])
|
app.engines[profile.GetOnion()], _ = profile.GenerateProtocolEngine(app.acn, app.eventBuses[profile.GetOnion()])
|
||||||
|
|
||||||
app.eventBuses[profile.GetOnion()].Publish(event.NewEventList(event.ProtocolEngineCreated))
|
app.eventBuses[profile.GetOnion()].Publish(event.NewEventList(event.ProtocolEngineCreated))
|
||||||
app.QueryACNStatus()
|
app.QueryACNStatus()
|
||||||
if doListen {
|
if doListen {
|
||||||
|
@ -290,6 +292,7 @@ func (app *application) ActivatePeerEngine(onion string, doListen, doPeers, doSe
|
||||||
}
|
}
|
||||||
profile.StartConnections(doPeers, doServers)
|
profile.StartConnections(doPeers, doServers)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeactivatePeerEngine shutsdown and cleans up a peer engine, should be called when an underlying ACN goes offline
|
// DeactivatePeerEngine shutsdown and cleans up a peer engine, should be called when an underlying ACN goes offline
|
||||||
|
|
Loading…
Reference in New Issue