Browse Source

move to version 2 to avoid utp clashes fully (utp uses 1)

session-estimator
Mathias Buus 4 years ago
parent
commit
3f199cf981
  1. 4
      index.js
  2. 6
      lib/messages.js

4
index.js

@ -140,7 +140,7 @@ class DHT extends EventEmitter {
const token = to.token || (opts && opts.token) || null
return this.rpc.request({
version: 1,
version: 2,
tid: 0,
from: null,
to,
@ -608,7 +608,7 @@ class DHT extends EventEmitter {
const closerNodes = target ? this.table.closest(target) : null
const ephemeral = socket !== this.rpc.socket || this.ephemeral
const reply = {
version: 1,
version: 2,
tid,
from: null,
to,

6
lib/messages.js

@ -66,7 +66,7 @@ exports.message = {
(m.target ? HAS_TARGET : 0) |
(m.command ? IS_REQUEST : 0)
state.buffer[state.start++] = 1
state.buffer[state.start++] = 2
state.buffer[state.start++] = flags
cenc.uint16.encode(state, m.tid)
@ -84,14 +84,14 @@ exports.message = {
decode (state) {
const version = state.buffer[state.start++]
if (version !== 1) {
if (version !== 2) {
throw new Error('Incompatible version')
}
const flags = cenc.uint.decode(state)
return {
version: 1,
version: 2,
tid: cenc.uint16.decode(state),
from: null, // populated in caller
to: peerIPv4.decode(state),

Loading…
Cancel
Save