Skip to content

Commit

Permalink
Added option to add custom interval between punches
Browse files Browse the repository at this point in the history
  • Loading branch information
supersuryaansh committed Nov 18, 2024
1 parent bd9ef84 commit 857ac56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ Options include:
// Supports suggested-IP to avoid DNS calls: [suggested-IP@]<host>:<port>
bootstrap: ['host:port'],
keyPair, // set the default key pair to use for server.listen and connect
connectionKeepAlive // set a default keep-alive (in ms) on all opened sockets. Defaults to 5000. Set false to turn off (advanced usage).
connectionKeepAlive, // set a default keep-alive (in ms) on all opened sockets. Defaults to 5000. Set false to turn off (advanced usage).
randomPunchInterval: 20000 // set a default time for interval between punches (in ms). Defaults to 20000.

}
```

Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class HyperDHT extends DHT {
this._validatedLocalAddresses = new Map()

this._lastRandomPunch = 0
this._randomPunchInterval = 20000 // min 20s between random punches...
this._randomPunchInterval = opts.randomPunchInterval || 20000 // min 20s between random punches...
this._randomPunches = 0
this._randomPunchLimit = 1 // set to one for extra safety for now

Expand Down

0 comments on commit 857ac56

Please sign in to comment.