-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Commit faa9526 introduced a module-level variable started (l.6-l.7) that is used to avoid reinitializing the unix socket twice. Unfortunately, when the plugin is used in two different Secret-Stacks running within the same node process, e.g. in unit tests, this strategy prevents the second instance from being initialized properly and is therefore ignored.
Moreover, l.27 returns undefined and therefore upon closing, the second instance fails with the following error:
.../node_modules/multiserver/compose.js:33
if (f.length) return f(cb)
^
TypeError: Cannot read property 'length' of undefined
at fnAsAsync (.../node_modules/multiserver/compose.js:33:11)
at closeMultiserverServer (.../node_modules/multiserver/index.js:57:37)
at close (.../node_modules/secret-stack/lib/core.js:259:82)
at hooked (.../node_modules/hoox/index.js:10:15)
at .../node_modules/ssb-db/index.js:90:11
at .../node_modules/flumedb/index.js:263:25
at .../node_modules/continuable-hash/index.js:25:25
at Single._written (.../node_modules/async-single/proto.js:46:12)
at release (.../node_modules/mutexify/index.js:25:13)
at .../node_modules/atomic-file/inject.js:27:11
npm ERR! Test failed. See above for more details.At least, l.27 should be fixed to avoid an error on closing. Better, the check for avoiding duplicate initialization should be specific to a specific instance of Secret-Stack and not module-wide (which is initialized only once for all node module imports).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels