Ensure that port reads do not block indefinitely if a user enters an incorrect timeout value (<100) on Linux or Mac.

This commit is contained in:
hedgecrw85 2016-12-05 14:51:06 -06:00
parent 5d9b261ee4
commit c943df001f
1 changed files with 2 additions and 0 deletions

View File

@ -657,6 +657,8 @@ public final class SerialPort
readTimeout = newReadTimeout;
writeTimeout = newWriteTimeout;
}
else if ((newReadTimeout > 0) && (newReadTimeout <= 100))
readTimeout = 100;
else
readTimeout = Math.round((float)newReadTimeout / 100.0f) * 100;