From 5294baf94966c45ce72f66f97fa83d61eacb8512 Mon Sep 17 00:00:00 2001 From: woodser Date: Thu, 16 Nov 2023 10:25:12 -0500 Subject: [PATCH] reset timeout timer after maker sends sign offer request --- .../offer/placeoffer/PlaceOfferProtocol.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java b/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java index 3875b5cc..e5d1120f 100644 --- a/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java +++ b/core/src/main/java/haveno/core/offer/placeoffer/PlaceOfferProtocol.java @@ -62,12 +62,13 @@ public class PlaceOfferProtocol { public void placeOffer() { - timeoutTimer = UserThread.runAfter(() -> { - handleError(Res.get("createOffer.timeoutAtPublishing")); - }, TradeProtocol.TRADE_TIMEOUT); + startTimeoutTimer(); TaskRunner taskRunner = new TaskRunner<>(model, () -> { + + // reset timer if response not yet received + if (model.getSignOfferResponse() == null) startTimeoutTimer(); }, (errorMessage) -> { handleError(errorMessage); @@ -99,10 +100,7 @@ public class PlaceOfferProtocol { } // reset timer - stopTimeoutTimer(); - timeoutTimer = UserThread.runAfter(() -> { - handleError(Res.get("createOffer.timeoutAtPublishing")); - }, TradeProtocol.TRADE_TIMEOUT); + startTimeoutTimer(); TaskRunner taskRunner = new TaskRunner<>(model, () -> { @@ -130,6 +128,13 @@ public class PlaceOfferProtocol { taskRunner.run(); } + private void startTimeoutTimer() { + stopTimeoutTimer(); + timeoutTimer = UserThread.runAfter(() -> { + handleError(Res.get("createOffer.timeoutAtPublishing")); + }, TradeProtocol.TRADE_TIMEOUT); + } + private void stopTimeoutTimer() { if (timeoutTimer != null) { timeoutTimer.stop();