Browse Source

make onrequest a function that can be overwritten

session-estimator
Mathias Buus 4 years ago
parent
commit
4537679e94
  1. 6
      index.js

6
index.js

@ -343,11 +343,15 @@ class DHT extends EventEmitter {
}
// ask the user to handle it or reply back with a bad command
if (this.emit('request', req) === false) {
if (this.onrequest(req) === false) {
req.sendReply(BAD_COMMAND, null, false, true)
}
}
onrequest (req) {
return this.emit('request', req)
}
_onresponse (res, external) {
this._addNodeFromNetwork(!external, res.from, res.to)
}

Loading…
Cancel
Save