mirror of
https://github.com/samuelncui/acp.git
synced 2025-12-23 05:05:15 +00:00
feat: add bad dst check
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"os/signal"
|
||||
|
||||
"github.com/abc950309/acp"
|
||||
"github.com/klauspost/cpuid/v2"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
@@ -33,7 +34,10 @@ func init() {
|
||||
func main() {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
cpuid.Flags()
|
||||
flag.Parse()
|
||||
cpuid.Detect()
|
||||
|
||||
sources := flag.Args()
|
||||
if len(sources) == 0 {
|
||||
logrus.Fatalf("cannot found source path")
|
||||
|
||||
5
copy.go
5
copy.go
@@ -15,7 +15,7 @@ import (
|
||||
"github.com/abc950309/acp/mmap"
|
||||
mapset "github.com/deckarep/golang-set/v2"
|
||||
"github.com/hashicorp/go-multierror"
|
||||
"github.com/minio/sha256-simd"
|
||||
sha256 "github.com/minio/sha256-simd"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -68,6 +68,9 @@ func (c *Copyer) copy(ctx context.Context, prepared <-chan *writeJob) <-chan *ba
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if badDsts.Cardinality() >= len(c.dst) {
|
||||
return
|
||||
}
|
||||
|
||||
wrap(ctx, func() { c.write(ctx, job, ch, cntr, badDsts) })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user