mirror of
https://github.com/mik3y/usb-serial-for-android
synced 2025-06-07 16:06:10 +00:00
fix write timeout calculation
This commit is contained in:
parent
4ffcc8d0fb
commit
cbed086279
@ -211,7 +211,7 @@ public abstract class CommonUsbSerialPort implements UsbSerialPort {
|
|||||||
throw new IOException("Connection closed");
|
throw new IOException("Connection closed");
|
||||||
}
|
}
|
||||||
while (offset < src.length) {
|
while (offset < src.length) {
|
||||||
final int requestTimeout;
|
int requestTimeout;
|
||||||
final int requestLength;
|
final int requestLength;
|
||||||
final int actualLength;
|
final int actualLength;
|
||||||
|
|
||||||
@ -230,6 +230,8 @@ public abstract class CommonUsbSerialPort implements UsbSerialPort {
|
|||||||
requestTimeout = timeout;
|
requestTimeout = timeout;
|
||||||
} else {
|
} else {
|
||||||
requestTimeout = (int)(endTime - System.currentTimeMillis());
|
requestTimeout = (int)(endTime - System.currentTimeMillis());
|
||||||
|
if(requestTimeout == 0)
|
||||||
|
requestTimeout = -1;
|
||||||
}
|
}
|
||||||
if (requestTimeout < 0) {
|
if (requestTimeout < 0) {
|
||||||
actualLength = -2;
|
actualLength = -2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user