From a65398c734535bf6ae947120f8cbf1518116db9b Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sun, 1 May 2022 00:09:12 +0100 Subject: [PATCH] script: In error handler, use piece_checkconflict_nrda This arranges that we stop drag if our grab failed for reasons other than a conflict which is obvious to us. Eg, insufficient currency. Signed-off-by: Ian Jackson --- templates/script.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/templates/script.ts b/templates/script.ts index bfe4480a..be5b606f 100644 --- a/templates/script.ts +++ b/templates/script.ts @@ -2128,13 +2128,14 @@ update_error_handlers.PieceOpError = function // Our gen was high enough we we sent this, that it ought to have // worked. Report it as a problem, then. add_log_message('Problem manipulating piece: ' + m.error_msg); - p.cseq_main = null; // Well, we don't have anything outstanding now - p.cseq_loose = null; + // Mark aus as having no outstanding requests, and cancel any drag. + piece_checkconflict_nrda(piece, p, true); } handle_piece_update(m.state); } -function piece_checkconflict_nrda(piece: PieceId, p: PieceInfo) { +function piece_checkconflict_nrda(piece: PieceId, p: PieceInfo, + already_logged: boolean = false) { // Our state machine for cseq: // // When we send an update (api_piece_x) we always set cseq. If the @@ -2164,7 +2165,8 @@ function piece_checkconflict_nrda(piece: PieceId, p: PieceInfo) { } } if (p.cseq_main != null) { - add_log_message('Conflict! - simultaneous update'); + if (!already_logged) + add_log_message('Conflict! - simultaneous update'); } p.cseq_main = null; p.cseq_loose = null; -- 2.30.2