bugfix for issue where peer may not have any extensions as advertised

This commit is contained in:
fisch0920 2014-05-15 06:31:42 -04:00
parent 5a3c0abe72
commit 677e4522ea
1 changed files with 2 additions and 2 deletions

View File

@ -39,7 +39,7 @@ module.exports = function (metadata) {
// TODO: throw or disregard invalid metadata? // TODO: throw or disregard invalid metadata?
//throw new Error('ut_metadata constructed with invalid metadata') //throw new Error('ut_metadata constructed with invalid metadata')
} }
if (info) if (info)
this._gotMetadata(info) this._gotMetadata(info)
} }
@ -50,7 +50,7 @@ module.exports = function (metadata) {
} }
ut_metadata.prototype.onExtendedHandshake = function (handshake) { ut_metadata.prototype.onExtendedHandshake = function (handshake) {
if (!handshake.m.ut_metadata) { if (!handshake.m || !handshake.m.ut_metadata) {
return this.emit('warning', new Error('Peer does not support ut_metadata')) return this.emit('warning', new Error('Peer does not support ut_metadata'))
} }
if (!handshake.metadata_size) { if (!handshake.metadata_size) {