Skip to content

Commit

Permalink
adjust
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijian-pro committed Oct 7, 2023
1 parent 63ee5a8 commit e3b3c45
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/sync/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,11 @@ func doCheckSum(src, dst object.ObjectStorage, key string, size int64, equal *bo
return err
}

func checkSum(src, dst object.ObjectStorage, key string, size int64, config *Config, obj object.Object, dstLinkPath string) (bool, error) {
func checkSum(src, dst object.ObjectStorage, key string, size int64, checkLink bool, obj object.Object, dstLinkPath string) (bool, error) {
start := time.Now()
var equal bool
err := try(3, func() error {
if obj.IsSymlink() && config.Links && dstLinkPath != "" {
if obj.IsSymlink() && checkLink && dstLinkPath != "" {
equal = obj.LinkPath() == dstLinkPath
return nil
} else {
Expand Down Expand Up @@ -530,7 +530,7 @@ func worker(tasks <-chan object.Object, src, dst object.ObjectStorage, config *C
}
withSizeObj := obj.(*withSize)
obj = withSizeObj.Object
if equal, err := checkSum(src, dst, key, obj.Size(), config, obj, withSizeObj.dstLinkPath); err != nil {
if equal, err := checkSum(src, dst, key, obj.Size(), config.Links, obj, withSizeObj.dstLinkPath); err != nil {
failed.Increment()
break
} else if equal {
Expand Down Expand Up @@ -575,7 +575,7 @@ func worker(tasks <-chan object.Object, src, dst object.ObjectStorage, config *C

if err == nil && (config.CheckAll || config.CheckNew) {
var equal bool
if equal, err = checkSum(src, dst, key, obj.Size(), config, obj, ""); err == nil && !equal {
if equal, err = checkSum(src, dst, key, obj.Size(), config.Links, obj, ""); err == nil && !equal {
err = fmt.Errorf("checksums of copied object %s don't match", key)
}
}
Expand Down

0 comments on commit e3b3c45

Please sign in to comment.