diff --git a/index.js b/index.js index ac2db1c..bf88bed 100644 --- a/index.js +++ b/index.js @@ -280,7 +280,11 @@ class Channel { module.exports = class Protomux { constructor(stream, { alloc, slave = false } = {}) { - if (stream.userData === null) stream.userData = this; + if (stream.userData) { + throw new Error("Mux already set for this stream"); + } + + stream.userData = this; this.isProtomux = true; this.stream = stream;