Browse Source

fix forever loop problem

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

10
go/storage/volume_replicate.go

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

Loading…
Cancel
Save