fix: add panic recovery to auto-scan, cap DHT nodes at 200
This commit is contained in:
parent
c476bd865c
commit
3badde606e
2 changed files with 10 additions and 0 deletions
|
|
@ -642,6 +642,11 @@ func saveDhtNodesBinary(client *torrent.Client) {
|
|||
return
|
||||
}
|
||||
|
||||
// Cap at 200 nodes to prevent unbounded file growth
|
||||
if len(allNodes) > 200 {
|
||||
allNodes = allNodes[:200]
|
||||
}
|
||||
|
||||
path := dhtNodesBinPath()
|
||||
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue