PIIODevice::readForTime fix
This commit is contained in:
@@ -378,7 +378,8 @@ PIByteArray PIIODevice::readForTime(double timeout_ms) {
|
||||
PIByteArray str;
|
||||
if (timeout_ms <= 0.) return str;
|
||||
ssize_t ret;
|
||||
uchar * td = new uchar[threaded_read_buffer_size];
|
||||
uchar * td = new uchar[threaded_read_buffer_size];
|
||||
bool was_br = setOption(BlockingRead, false);
|
||||
tm.reset();
|
||||
while (tm.elapsed_m() < timeout_ms) {
|
||||
ret = read(td, threaded_read_buffer_size);
|
||||
@@ -387,6 +388,7 @@ PIByteArray PIIODevice::readForTime(double timeout_ms) {
|
||||
else
|
||||
str.append(td, ret);
|
||||
}
|
||||
setOption(BlockingRead, was_br);
|
||||
delete[] td;
|
||||
return str;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user