fakeswarm 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/package.json +1 -1
- package/src/index.js +1 -0
package/README.md
CHANGED
|
@@ -81,6 +81,7 @@ Returns an object with:
|
|
|
81
81
|
### Join / leave semantics
|
|
82
82
|
- Joining registers this swarm in the shared topics map; peers that share a topic will connect.
|
|
83
83
|
- Leaving (or closing) removes the entry from the shared map to avoid ghost peers.
|
|
84
|
+
- **Testing tip:** pass a fresh `topics = new Map()` per test to avoid cross-test bleed; the default module-level map is shared across all swarms in the process.
|
|
84
85
|
|
|
85
86
|
### Determinism notes
|
|
86
87
|
- Dial election: only the lexicographically smaller peerId initiates (`peerId < remotePeerId`), preventing double connects.
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -33,6 +33,7 @@ function createFakeSwarm(seedOrOpts = undefined, topicsArg = defaultTopics) {
|
|
|
33
33
|
const reconnectTimers = new Set();
|
|
34
34
|
|
|
35
35
|
const emitter = new EventEmitter();
|
|
36
|
+
emitter.setMaxListeners(0);
|
|
36
37
|
const joinedTopics = new Set(); // all topics we joined (regardless of mode)
|
|
37
38
|
const dialTopics = new Set(); // topics where we will attempt outbound dials (client mode)
|
|
38
39
|
const publishedTopics = new Set(); // topics we publish into the shared map (server mode)
|