| Index: device/serial/serial_io_handler_posix.cc
|
| diff --git a/device/serial/serial_io_handler_posix.cc b/device/serial/serial_io_handler_posix.cc
|
| index 71b398c889b9eae7284bb699319f9114a50772a5..59582c5b84e7dea1ffe4b2d8306a103e6e0baebe 100644
|
| --- a/device/serial/serial_io_handler_posix.cc
|
| +++ b/device/serial/serial_io_handler_posix.cc
|
| @@ -348,10 +348,16 @@ bool SerialIoHandlerPosix::AttemptRead(bool within_read) {
|
| void SerialIoHandlerPosix::RunReadCompleted(bool within_read,
|
| int bytes_read,
|
| serial::ReceiveError error) {
|
| - if (within_read)
|
| + if (within_read) {
|
| + // Stop watching the fd to avoid more reads until the queued ReadCompleted()
|
| + // completes and releases the pending_read_buffer.
|
| + is_watching_reads_ = false;
|
| + file_read_watcher_.StopWatchingFileDescriptor();
|
| +
|
| QueueReadCompleted(bytes_read, error);
|
| - else
|
| + } else {
|
| ReadCompleted(bytes_read, error);
|
| + }
|
| }
|
|
|
| void SerialIoHandlerPosix::OnFileCanWriteWithoutBlocking(int fd) {
|
|
|