Commit 713629b4 authored by rockot@chromium.org's avatar rockot@chromium.org

Remove timeout behavior from Windows serial I/O

Reads on the Windows impl of SerialConnection were erroneously set to
wait for up to 10ms before completing with less than the requested
amount of data.

They will now complete immediately with any available data, without
waiting.

BUG=324886

Review URL: https://codereview.chromium.org/100813002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238367 0039d316-1c4b-4281-b951-d872f2087c98
parent 9c879191
...@@ -158,12 +158,12 @@ bool SerialConnection::ConfigurePort( ...@@ -158,12 +158,12 @@ bool SerialConnection::ConfigurePort(
} }
bool SerialConnection::PostOpen() { bool SerialConnection::PostOpen() {
// Set a very brief read interval timeout. This prevents the asynchronous I/O // A ReadIntervalTimeout of MAXDWORD will cause async reads to complete
// system from being way too eager to fire off completion events which would // immediately with any data that's available, even if there is none.
// in turn result in a lot of onReceive events being fired (i.e., one for // This is OK because we never issue a read request until WaitCommEvent
// every individual byte received on the serial buffer.) // signals that data is available.
COMMTIMEOUTS timeouts = { 0 }; COMMTIMEOUTS timeouts = { 0 };
timeouts.ReadIntervalTimeout = 10; timeouts.ReadIntervalTimeout = MAXDWORD;
if (!::SetCommTimeouts(file_, &timeouts)) { if (!::SetCommTimeouts(file_, &timeouts)) {
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment