mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-01 18:29:16 +01:00
AndroidGCS Telemetry: Sending an update could interrupt a pending transaction
We allow sending objects that don't create a transaction while waiting for one to complete. However, this was overriding the pending transaction information (when there wasn't a new transaction) and masking the transaction completed message. Note: I think this logical error can occur on the GCS side and might explain the "transaction completed when not expected" messages.
This commit is contained in:
parent
5c55dc07b0
commit
b0522a319f
@ -638,11 +638,7 @@ public class Telemetry {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store this as the active transaction
|
if (DEBUG) Log.d(TAG, "Process Object transaction for " + newTrans.obj.getName());
|
||||||
transPending = newTransactionPending;
|
|
||||||
transInfo = newTrans;
|
|
||||||
|
|
||||||
if (DEBUG) Log.d(TAG, "Process Object transaction for " + transInfo.obj.getName());
|
|
||||||
|
|
||||||
// Remove this one from the list of pending transactions
|
// Remove this one from the list of pending transactions
|
||||||
handler.removeActivatedQueue(objInfo);
|
handler.removeActivatedQueue(objInfo);
|
||||||
@ -650,12 +646,12 @@ public class Telemetry {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
// 3. Execute transaction by sending the appropriate UAVTalk command
|
// 3. Execute transaction by sending the appropriate UAVTalk command
|
||||||
if (transInfo.objRequest) {
|
if (newTrans.objRequest) {
|
||||||
if (DEBUG) Log.d(TAG, "Sending object request " + transInfo.obj.getName());
|
if (DEBUG) Log.d(TAG, "Sending object request " + newTrans.obj.getName());
|
||||||
utalk.sendObjectRequest(transInfo.obj, transInfo.allInstances);
|
utalk.sendObjectRequest(newTrans.obj, newTrans.allInstances);
|
||||||
} else {
|
} else {
|
||||||
if (DEBUG) Log.d(TAG, "Sending object " + transInfo.obj.getName());
|
if (DEBUG) Log.d(TAG, "Sending object " + newTrans.obj.getName());
|
||||||
utalk.sendObject(transInfo.obj, transInfo.acked, transInfo.allInstances);
|
utalk.sendObject(newTrans.obj, newTrans.acked, newTrans.allInstances);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -663,9 +659,17 @@ public class Telemetry {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Post a timeout timer if a response is epxected
|
// Store this as the active transaction. However in the case
|
||||||
if (transPending)
|
// of transPending && !newTransactionPending we need ot not
|
||||||
|
// override the previous pending transaction
|
||||||
|
if (!transPending && newTransactionPending) {
|
||||||
|
transPending = newTransactionPending;
|
||||||
|
transInfo = newTrans;
|
||||||
|
|
||||||
|
// Post a timeout timer if a response is epxected
|
||||||
handler.postDelayed(transactionTimeout, REQ_TIMEOUT_MS);
|
handler.postDelayed(transactionTimeout, REQ_TIMEOUT_MS);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -750,7 +754,7 @@ public class Telemetry {
|
|||||||
//Send signal
|
//Send signal
|
||||||
obj.transactionCompleted(result);
|
obj.transactionCompleted(result);
|
||||||
} else {
|
} else {
|
||||||
if (ERROR) Log.e(TAG, "Error: received a transaction completed when did not expect it.");
|
if (ERROR) Log.e(TAG, "Error: received a transaction completed when did not expect it. " + obj.getName());
|
||||||
transPending = false;
|
transPending = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user