httpdl: add segment work-stealing and --auto-split
an idle worker now steals the back half of the busiest in-flight segment instead of exiting, so one slow segment no longer drains alone over a single connection. control file persists stolen tails; resume re-tiles. add --auto-split (got-only, opt-in): derive the connection count from file size (one per min-split-size, up to 16), overriding -x/-s. default stays aria2-faithful at 1 connection for a single server.
This commit is contained in:
@@ -27,11 +27,13 @@ type segState struct {
|
||||
|
||||
func controlPath(out string) string { return out + ".got" }
|
||||
|
||||
// snapshot builds a control record from the live segments.
|
||||
func snapshot(url string, total int64, etag, lastmod string, segs []seg) control {
|
||||
// snapshot builds a control record from the live segments. Callers hold the
|
||||
// pool lock (see pool.snapshot) so the slice and each segment's frontier are
|
||||
// stable for the read.
|
||||
func snapshot(url string, total int64, etag, lastmod string, segs []*seg) control {
|
||||
c := control{URL: url, Total: total, ETag: etag, LastModified: lastmod, Segs: make([]segState, len(segs))}
|
||||
for i := range segs {
|
||||
c.Segs[i] = segState{segs[i].start, segs[i].end, atomic.LoadInt64(&segs[i].written)}
|
||||
c.Segs[i] = segState{segs[i].start, segs[i].endOff(), atomic.LoadInt64(&segs[i].written)}
|
||||
}
|
||||
return c
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user