Skip to content

Commit 13eb75c

Browse files
Added option to add custom interval between punches (#207)
1 parent bd9ef84 commit 13eb75c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,9 @@ Options include:
7373
// Supports suggested-IP to avoid DNS calls: [suggested-IP@]<host>:<port>
7474
bootstrap: ['host:port'],
7575
keyPair, // set the default key pair to use for server.listen and connect
76-
connectionKeepAlive // set a default keep-alive (in ms) on all opened sockets. Defaults to 5000. Set false to turn off (advanced usage).
76+
connectionKeepAlive, // set a default keep-alive (in ms) on all opened sockets. Defaults to 5000. Set false to turn off (advanced usage).
77+
randomPunchInterval: 20000 // set a default time for interval between punches (in ms). Defaults to 20000.
78+
7779
}
7880
```
7981

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class HyperDHT extends DHT {
4242
this._validatedLocalAddresses = new Map()
4343

4444
this._lastRandomPunch = 0
45-
this._randomPunchInterval = 20000 // min 20s between random punches...
45+
this._randomPunchInterval = opts.randomPunchInterval || 20000 // min 20s between random punches...
4646
this._randomPunches = 0
4747
this._randomPunchLimit = 1 // set to one for extra safety for now
4848

0 commit comments

Comments
 (0)