|
|
@ -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), |
|
|
|