File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -181,25 +181,28 @@ class StreamCopyT {
181
181
}
182
182
183
183
// / copies all data - returns true if we copied anything
184
- bool copyAll (int retryCount=2 , int retryWaitMs=2000 ){
184
+ size_t copyAll (int retryCount=2 , int retryWaitMs=2000 ){
185
185
LOGD (LOG_METHOD);
186
- bool result = false ;
186
+ size_t result = 0 ;
187
+ int retry = 0 ;
188
+
187
189
if (from==nullptr || to == nullptr )
188
190
return result;
189
191
190
- int retry = 0 ;
191
- // copy whily source has data available
192
+ // copy while source has data available
193
+ int count= 0 ;
192
194
while (true ){
193
- int count = copy ();
195
+ count = copy ();
196
+ result += count;
194
197
if (count==0 ){
195
198
// wait for more data
196
199
retry++;
197
200
delay (retryWaitMs);
198
201
} else {
199
202
result = true ; // we have some data
200
- retry = 0 ;
203
+ retry = 0 ; // after we got new data we restart the counting
201
204
}
202
- // stop the processing
205
+ // stop the processing if we passed the retry limit
203
206
if (retry>retryCount){
204
207
break ;
205
208
}
You can’t perform that action at this time.
0 commit comments