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