elephant.io icon indicating copy to clipboard operation
elephant.io copied to clipboard

readBytes fix-read-endless-loop

Open yufewell opened this issue 6 years ago • 5 comments

fix readBytes endless loop

yufewell avatar Nov 18 '19 06:11 yufewell

@yufewell, could you have any test to prove this change?

peter279k avatar Nov 18 '19 10:11 peter279k

@yufewell, could you have any test to prove this change?

yes, cut off wi-fi then readBytes will be endless loop, i find that the stream's timed_out become true, hope it helpful.

yufewell avatar Nov 18 '19 11:11 yufewell

Not sure why we would break out of a loop to stop reading but okay. The reading mechanism is flawed anyways... this is only happen while network is nearly turned off. when network is terrible, fread alwarys return empty string, so the stream will become timed out, then the loop will last forever. in my case, i need break to reconnect to server...

yufewell avatar Nov 19 '19 04:11 yufewell

Not sure why we would break out of a loop to stop reading but okay. The reading mechanism is flawed anyways...

also can use keepAlive function to reconnect...

yufewell avatar Nov 20 '19 08:11 yufewell

To be honest, not sure if I'm truly convinced this patch is needed. But I can be wrong...

You, wrong ? Nah !!!! :trollface:

guillaumepotier avatar Dec 03 '19 07:12 guillaumepotier