Error upon bootstraping
Closed this issue · 5 comments
I have a BS server running within node. Code for this:
(function () {
const DHT = require("webtorrent-dht");
const options = {
nodes: [],
simple_peer_opts: {
config: {
iceServers: []
}
}
};
global.buffer = require("buffer").Buffer;
global.bencode = require("bencode");
global.dht = new DHT(options);
global.dht.listen(16881, "127.0.0.1", function () {
console.log("now listening");
});
global.dht.on("error", function (err) {
console.log(err);
});
global.dht.on("warning", function (war) {
console.log(war);
});
}).call(this);
I start a node within Chromium with this:
function startUp () {
let options = {
nodes: [{
host: "127.0.0.1",
port: 16881
}],
simple_peer_opts: {
config: {
iceServers: []
}
}
};
global.dht = new webtorrentDht(options);
}
The following error is thrown on the server:
TypeError: Cannot read property 'map' of undefined
at Peer.x$.signal (/home/hirnheiner/repos/p2ps/node_modules/webtorrent-dht/webrtc-socket.js:270:37)
at WebSocket.<anonymous> (/home/hirnheiner/repos/p2ps/node_modules/webtorrent-dht/webrtc-socket.js:92:27)
at emitOne (events.js:96:13)
at WebSocket.emit (events.js:188:7)
at Receiver._receiver.onmessage (/home/hirnheiner/repos/p2ps/node_modules/ws/lib/WebSocket.js:143:47)
at Receiver.dataMessage (/home/hirnheiner/repos/p2ps/node_modules/ws/lib/Receiver.js:380:14)
at Receiver.getData (/home/hirnheiner/repos/p2ps/node_modules/ws/lib/Receiver.js:330:12)
at Receiver.startLoop (/home/hirnheiner/repos/p2ps/node_modules/ws/lib/Receiver.js:165:16)
at Receiver.add (/home/hirnheiner/repos/p2ps/node_modules/ws/lib/Receiver.js:139:10)
at Socket._ultron.on (/home/hirnheiner/repos/p2ps/node_modules/ws/lib/WebSocket.js:139:22)
This error occured after updating from version 0.5.1 to 0.7.0.
Did you update both client and server code at the same time?
Yup. All the code is living in the same repo with the same dependencies.
I mean you have to re-run browserify to update frontend build, otherwise browser will not send extensions
property as part of signaling message. Looks like there are only 4 places where signal
object is generated and all of them were updated to include extensions
property, see e84a632
I've added additional check though that will be a part of the next release: ece7e2d
Damn. It seems like I forgot that >.<
I will add get myself a automated build system for the future :D
Sorry for the trouble!