ssbc / ssb-conn

SSB plugin for establishing and managing peer connections
MIT License
16 stars 5 forks source link

Cannot read property 'hub' of undefined #10

Closed christianbundy closed 4 years ago

christianbundy commented 4 years ago

I think I found a bug by shuffling my secret-stack plugins.

(node:201501) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'hub' of undefined
    at Gossip.setupConnectionListeners (/home/christianbundy/src/flotilla/node_modules/ssb-conn/lib/gossip.js:190:24)
    at new Gossip (/home/christianbundy/src/flotilla/node_modules/ssb-conn/lib/gossip.js:182:14)
    at Object.init (/home/christianbundy/src/flotilla/node_modules/secret-stack-decorators/lib/index.js:61:23)
    at /home/christianbundy/src/flotilla/node_modules/secret-stack/api.js:33:28
    at Array.forEach (<anonymous>)
    at create (/home/christianbundy/src/flotilla/node_modules/secret-stack/api.js:32:20)
    at rawConnect.then.catch (/home/christianbundy/src/oasis/src/pages/models/lib/cooler.js:80:5)
    at process._tickCallback (internal/process/next_tick.js:68:7)
christianbundy commented 4 years ago
  189     setupConnectionListeners() {
  190         pull(this.conn.hub().listen(), pull.drain((ev) => {
  191             if (ev.type === 'connecting-failed')
  192                 this.onConnectingFailed(ev);
  193             if (ev.type === 'connected')
  194                 this.onConnected(ev);
  195             if (ev.type === 'disconnected')
  196                 this.onDisconnected(ev);
  197         }));
  198     }
christianbundy commented 4 years ago

Oops. TIL secret-stack plugins can be arrays (!). Sorry for the noise.