Fix issue with dangling msg

This commit is contained in:
Manfred Karrer 2015-12-28 00:44:26 +01:00
parent 38afa428ba
commit c5ea60c2fe
2 changed files with 17 additions and 4 deletions

View File

@ -59,7 +59,7 @@ public class PaymentMethod implements Serializable, Comparable {
public static PaymentMethod BLOCK_CHAINS;
public static final List<PaymentMethod> ALL_VALUES = new ArrayList<>(Arrays.asList(
OK_PAY = new PaymentMethod(OK_PAY_ID, 0, HOUR), // tx instant so min. wait time
OK_PAY = new PaymentMethod(OK_PAY_ID, 0, DAY), // tx instant so min. wait time
PERFECT_MONEY = new PaymentMethod(PERFECT_MONEY_ID, 0, DAY),
SEPA = new PaymentMethod(SEPA_ID, 0, 8 * DAY), // sepa takes 1-3 business days. We use 8 days to include safety for holidays
SWISH = new PaymentMethod(SWISH_ID, 0, DAY),

View File

@ -122,8 +122,14 @@ public class AuthenticationHandshake implements MessageListener {
// now we add the reported peers to our list
addReportedPeersConsumer.accept(authenticationChallenge.reportedPeers, connection);
} else {
log.warn("Verification of nonce failed. nonce={} / peerAddress={} / authenticationChallenge={}", nonce, peerAddress, authenticationChallenge);
failed(new Exception("Verification of nonce failed. AuthenticationChallenge=" + authenticationChallenge + " / nonceMap=" + nonce));
// We don't call failed as it might be that we get an old authenticationChallenge from a
// previously timed out request
// We simply ignore the authenticationChallenge if the nonce is not matching to avoid that
// the current authentication turn gets terminated as well
log.warn("Verification of nonce failed. Maybe we got an old authenticationChallenge " +
"from a timed out request" +
"\nnonce={} / peerAddress={} / authenticationChallenge={}", nonce, peerAddress, authenticationChallenge);
//failed(new AuthenticationException("Verification of nonce failed. AuthenticationChallenge=" + authenticationChallenge + " / nonceMap=" + nonce));
}
} else if (message instanceof AuthenticationFinalResponse) {
// Responding peer
@ -137,8 +143,15 @@ public class AuthenticationHandshake implements MessageListener {
+ (System.currentTimeMillis() - startAuthTs) + " ms.");
completed(connection);
} else {
// We don't call failed as it might be that we get an old authenticationFinalResponse from a
// previously timed out request
// We simply ignore the authenticationFinalResponse if the nonce is not matching to avoid that
// the current authentication turn gets terminated as well
log.warn("Verification of nonce failed. Maybe we got an old authenticationFinalResponse " +
"from a timed out request" +
"\nnonce={} / peerAddress={} / authenticationChallenge={}", nonce, peerAddress, authenticationFinalResponse);
log.warn("Verification of nonce failed. nonce={} / peerAddress={} / authenticationFinalResponse={}", nonce, peerAddress, authenticationFinalResponse);
failed(new Exception("Verification of nonce failed. getPeersMessage=" + authenticationFinalResponse + " / nonce=" + nonce));
//failed(new AuthenticationException("Verification of nonce failed. getPeersMessage=" + authenticationFinalResponse + " / nonce=" + nonce));
}
} else if (message instanceof AuthenticationRejection) {
// Any peer