fix: do Connection.Open() in goroutine to avoid blocking other peers

This commit is contained in:
braginini
2021-04-16 15:26:10 +02:00
parent 3d8233034d
commit b86c0c716c
2 changed files with 12 additions and 10 deletions

View File

@@ -89,11 +89,13 @@ func (e *Engine) Start(privateKey string, peers []string) error {
conn := NewConnection(*connConfig, signalCandidate, signalOffer, signalAnswer)
e.conns[myPubKey] = conn
err = conn.Open()
if err != nil {
log.Errorf("error openning connection to a remote peer %s %s", remoteKey.String(), err.Error())
return err
}
go func() {
err = conn.Open()
if err != nil {
log.Errorf("error openning connection to a remote peer %s %s", remoteKey.String(), err.Error())
//todo
}
}()
}
return nil