mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-23 03:59:36 +00:00
process mailbox messages on main thread on startup
This commit is contained in:
parent
cfaca6e0d8
commit
3d0b8c0b09
1 changed files with 8 additions and 11 deletions
|
@ -109,7 +109,7 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
|
||||||
|
|
||||||
protected void onTradeMessage(TradeMessage message, NodeAddress peerNodeAddress) {
|
protected void onTradeMessage(TradeMessage message, NodeAddress peerNodeAddress) {
|
||||||
log.info("Received {} as TradeMessage from {} with tradeId {} and uid {}", message.getClass().getSimpleName(), peerNodeAddress, message.getTradeId(), message.getUid());
|
log.info("Received {} as TradeMessage from {} with tradeId {} and uid {}", message.getClass().getSimpleName(), peerNodeAddress, message.getTradeId(), message.getUid());
|
||||||
handle(message, peerNodeAddress);
|
new Thread(() -> handle(message, peerNodeAddress)).start();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onMailboxMessage(TradeMessage message, NodeAddress peerNodeAddress) {
|
protected void onMailboxMessage(TradeMessage message, NodeAddress peerNodeAddress) {
|
||||||
|
@ -118,15 +118,13 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handle(TradeMessage message, NodeAddress peerNodeAddress) {
|
private void handle(TradeMessage message, NodeAddress peerNodeAddress) {
|
||||||
new Thread(() -> {
|
if (message instanceof DepositsConfirmedMessage) {
|
||||||
if (message instanceof DepositsConfirmedMessage) {
|
handle((DepositsConfirmedMessage) message, peerNodeAddress);
|
||||||
handle((DepositsConfirmedMessage) message, peerNodeAddress);
|
} else if (message instanceof PaymentSentMessage) {
|
||||||
} else if (message instanceof PaymentSentMessage) {
|
handle((PaymentSentMessage) message, peerNodeAddress);
|
||||||
handle((PaymentSentMessage) message, peerNodeAddress);
|
} else if (message instanceof PaymentReceivedMessage) {
|
||||||
} else if (message instanceof PaymentReceivedMessage) {
|
handle((PaymentReceivedMessage) message, peerNodeAddress);
|
||||||
handle((PaymentReceivedMessage) message, peerNodeAddress);
|
}
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -523,7 +521,6 @@ public abstract class TradeProtocol implements DecryptedDirectMessageListener, D
|
||||||
Validator.checkTradeId(processModel.getOfferId(), message);
|
Validator.checkTradeId(processModel.getOfferId(), message);
|
||||||
processModel.setTradeMessage(message);
|
processModel.setTradeMessage(message);
|
||||||
|
|
||||||
|
|
||||||
// check minimum trade phase
|
// check minimum trade phase
|
||||||
if (trade.isBuyer() && trade.getPhase().ordinal() < Trade.Phase.PAYMENT_SENT.ordinal()) {
|
if (trade.isBuyer() && trade.getPhase().ordinal() < Trade.Phase.PAYMENT_SENT.ordinal()) {
|
||||||
log.warn("Received PaymentReceivedMessage before payment sent for {} {}, ignoring", trade.getClass().getSimpleName(), trade.getId());
|
log.warn("Received PaymentReceivedMessage before payment sent for {} {}, ignoring", trade.getClass().getSimpleName(), trade.getId());
|
||||||
|
|
Loading…
Reference in a new issue