From 860a4ce1812dcc25c9876587619de61eb48b26e4 Mon Sep 17 00:00:00 2001 From: John Hiesey Date: Thu, 4 Mar 2021 21:38:21 -0800 Subject: Destroy torrent if putting into store fails --- lib/torrent.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/torrent.js b/lib/torrent.js index 930304f..3760db2 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -1599,7 +1599,9 @@ class Torrent extends EventEmitter { self._reservations[index] = null self.bitfield.set(index, true) - self.store.put(index, buf) + self.store.put(index, buf, err => { + if (err) self._destroy(err) + }) self.wires.forEach(wire => { wire.have(index) -- cgit v1.2.3