Browse Source

fix forever loop problem

pull/283/head
tnextday 10 years ago
parent
commit
848930ab5a
  1. 16
      go/storage/volume_replicate.go

16
go/storage/volume_replicate.go

@ -123,14 +123,14 @@ func (cdr *CleanReader) WriteTo(w io.Writer) (written int64, err error) {
if nextDirty != nil { if nextDirty != nil {
sz = nextDirty.Offset - off sz = nextDirty.Offset - off
} }
if sz > 0 {
if n, e = io.CopyN(w, cdr.DataFile, sz); e != nil {
return
}
} else {
if n, e = io.Copy(w, cdr.DataFile); e != nil {
return
}
if sz <= 0 {
// copy until eof
n, e = io.Copy(w, cdr.DataFile);
written += n
return
}
if n, e = io.CopyN(w, cdr.DataFile, sz); e != nil {
return
} }
off += n off += n
written += n written += n

Loading…
Cancel
Save