change `wakuDisconnectionTimer` to handle light protocols

This commit is contained in:
Felicio Mununga 2022-11-27 17:45:56 +01:00
parent c925efbaf5
commit e20df9b0bb
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
1 changed files with 10 additions and 2 deletions

View File

@ -100,7 +100,13 @@ class Client {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
emitSelf: true,
pingKeepAlive: 15,
/**
* Note: Delegated to `wakuDisconnectionTimer`.
*/
pingKeepAlive: 0,
/**
* Note: Not supported in light mode.
*/
relayKeepAlive: 0,
libp2p: {
peerDiscovery: [
@ -124,7 +130,9 @@ class Client {
const connectionsToClose: Promise<void>[] = []
for (const connection of waku!.libp2p.connectionManager.getConnections()) {
if (!connection.streams.length) {
try {
await waku!.libp2p.ping(connection.remoteAddr)
} catch {
connectionsToClose.push(connection.close())
}
}