refactor: circuit relay to async (#477)

* refactor: add dialing over relay support

* chore: fix lint

* fix: dont clear listeners on close

* fix: if dial errors already have codes, just rethrow them

* fix: clear the registrar when libp2p stops

* fix: improve connection maintenance with circuit

* chore: correct feedback

* test: use chai as promised

* test(fix): reset multiaddrs on dial test
This commit is contained in:
Jacob Heun
2019-11-29 16:41:08 +01:00
parent 18a062ed12
commit f77ce39484
30 changed files with 937 additions and 1169 deletions

View File

@ -64,7 +64,9 @@ class TransportManager {
await Promise.all(tasks)
log('all listeners closed')
this._listeners.clear()
for (const key of this._listeners.keys()) {
this._listeners.set(key, [])
}
}
/**
@ -82,6 +84,7 @@ class TransportManager {
try {
return await transport.dial(ma, options)
} catch (err) {
if (err.code) throw err
throw errCode(err, codes.ERR_TRANSPORT_DIAL_FAILED)
}
}