forked from cwtch.im/tapir
Merge pull request 'Set the App Before Initializing The App Over the Connection...' (#41) from chainbug into master
Reviewed-on: cwtch.im/tapir#41
This commit is contained in:
commit
137461e2cd
|
@ -40,13 +40,17 @@ func (appchain *ApplicationChain) NewInstance() tapir.Application {
|
|||
func (appchain *ApplicationChain) Init(connection tapir.Connection) {
|
||||
appchain.TranscriptApp.Init(connection)
|
||||
for i, app := range appchain.apps {
|
||||
// propagate the transcript to the app
|
||||
app.PropagateTranscript(appchain.transcript)
|
||||
// apply the app to the connection
|
||||
connection.SetApp(app)
|
||||
// initialize the application given the connection
|
||||
app.Init(connection)
|
||||
// if we hit our guard then carry on, otherwise close...
|
||||
if !connection.HasCapability(appchain.capabilities[i]) {
|
||||
connection.Close()
|
||||
return
|
||||
}
|
||||
connection.SetApp(app)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue