auto-sync

This commit is contained in:
rusEfi 2015-05-16 00:04:52 -04:00
parent d1856c1406
commit d7c99c5199
2 changed files with 7 additions and 4 deletions

View File

@ -105,6 +105,8 @@ public class TestingUtils {
}
static EngineChart nextChart() {
getNextWaveChart();
getNextWaveChart();
return EngineChartParser.unpackToMap(getNextWaveChart());
}

View File

@ -165,9 +165,9 @@ public class BinaryProtocol {
long start = System.currentTimeMillis();
while (true) {
dropPending();
try {
dropPending();
stream.write("~\n".getBytes());
synchronized (cbb) {
boolean isTimeout = waitForBytes(2, start, "switch to binary");
@ -194,7 +194,7 @@ public class BinaryProtocol {
}
}
private void dropPending() {
private void dropPending() throws IOException {
synchronized (cbb) {
if (isClosed)
return;
@ -337,8 +337,9 @@ public class BinaryProtocol {
public byte[] exchange(byte[] packet, String msg, boolean allowLongResponse) {
if (isClosed)
return null;
dropPending();
try {
dropPending();
sendCrcPacket(packet);
return receivePacket(msg, allowLongResponse);
} catch (InterruptedException e) {