This website works better with JavaScript.
Home
Issues
Pull Requests
Milestones
AI流水线
Repositories
Datasets
Forum
实训
竞赛
大数据
AI开发
Register
Sign In
JointCloud
/
common
Not watched
Unwatch
Watch all
Watch but not notify
1
Star
0
Fork
0
Code
Releases
0
Wiki
evaluate
Activity
Issues
0
Pull Requests
0
Datasets
Model
Cloudbrain
HPC
Browse Source
解决一些读取流时错误处理EOF的问题
pengcheng
Sydonian
1 year ago
parent
07fa8a6fcd
commit
d66f32af17
1 changed files
with
10 additions
and
4 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+10
-4
utils/io2/range.go
+ 10
- 4
utils/io2/range.go
View File
@@ -37,16 +37,22 @@ func (r *rng) Read(p []byte) (n int, err error) {
need := math2.Min(*r.length, int64(len(p)))
rd, err := r.inner.Read(p[:need])
if err != nil {
r.err = err
return rd, io.EOF
}
*r.length -= int64(rd)
if *r.length == 0 {
r.err = io.EOF
}
if err == nil {
return rd, nil
}
if err != io.EOF {
r.err = err
return rd, err
}
r.err = io.EOF
return rd, nil
}
Write
Preview
Loading…
Cancel
Save