Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
arti
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
morenonatural
arti
Commits
bf3c4225
Commit
bf3c4225
authored
3 years ago
by
morenonatural
Browse files
Options
Downloads
Patches
Plain Diff
shrink result to actual number of bytes read once on return
parent
161d5312
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tor-dirclient/src/lib.rs
+8
-6
8 additions, 6 deletions
tor-dirclient/src/lib.rs
with
8 additions
and
6 deletions
tor-dirclient/src/lib.rs
+
8
−
6
View file @
bf3c4225
...
...
@@ -304,15 +304,17 @@ where
written_total
+=
written_in_this_loop
;
// in case we read less than `buffer_window_size` we need to shrink result
// because otherwise we'll return those un-read 0s
if
written_total
<
result
.len
()
{
result
.resize
(
written_total
,
0
);
}
// exit conditions below
if
written_in_this_loop
==
0
{
/*
in case we read less than `buffer_window_size` in last `read`
we need to shrink result because otherwise we'll return those
un-read 0s
*/
if
written_total
<
result
.len
()
{
result
.resize
(
written_total
,
0
);
}
return
Ok
(());
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment