[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-taler-mdb] 36/93: fixed delay when cancelling, new bugs detected
From: |
gnunet |
Subject: |
[taler-taler-mdb] 36/93: fixed delay when cancelling, new bugs detected marked with FIXME |
Date: |
Mon, 18 Nov 2019 21:12:59 +0100 |
This is an automated email from the git hooks/post-receive script.
marco-boss pushed a commit to branch master
in repository taler-mdb.
commit 0609d5c9cb0aaee6a3a0c9f7b6497b9aad488982
Author: BOSS_Marco <address@hidden>
AuthorDate: Sat Nov 9 20:00:40 2019 +0100
fixed delay when cancelling, new bugs detected marked with FIXME
---
configure.ac | 2 +-
src/main.c | 52 ++++++++++++++++++++++++----------------------------
2 files changed, 25 insertions(+), 29 deletions(-)
diff --git a/configure.ac b/configure.ac
index 36a65c3..82bb82f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@
AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
-AC_CONFIG_SRCDIR([src/product.c])
+AC_CONFIG_SRCDIR([src/])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
diff --git a/src/main.c b/src/main.c
index 0de6f34..51aa6b1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -96,8 +96,6 @@ struct PaymentActivity
struct GNUNET_SCHEDULER_Task *delay_task;
- int nfc_has_target;
-
int wallet_has_uri;
};
@@ -169,6 +167,11 @@ SNACK_print_hex_info (const char*message,
static void
cleanup_payment (struct PaymentActivity *pa)
{
+ if (NULL != pa->pnd)
+ {
+ nfc_abort_command(pa->pnd);
+ nfc_close (pa->pnd);
+ }
if (NULL != pa->po)
TALER_MERCHANT_proposal_cancel (pa->po);
if (NULL != pa->cpo)
@@ -176,11 +179,8 @@ cleanup_payment (struct PaymentActivity *pa)
if (NULL != pa->task)
GNUNET_SCHEDULER_cancel (pa->task);
if (NULL != pa->delay_task)
- GNUNET_SCHEDULER_cancel (pa->delay_task);
- if (GNUNET_YES == pa->nfc_has_target)
- nfc_initiator_deselect_target (pa->pnd); // needed?
- if (NULL != pa->pnd)
- nfc_close (pa->pnd);
+ GNUNET_SCHEDULER_cancel (pa->delay_task); /* FIXME - double free or
corruption (!prev) - when already sent a message via nfc and then press 'c'
(abort) */
+ /* FIXME - cont. also abort when nfc device gets disconnected (maybe this
is ok? because nfc is mandatory) */
GNUNET_free_non_null (pa->taler_pay_uri);
GNUNET_free_non_null (pa->order_id);
GNUNET_free (pa);
@@ -258,7 +258,7 @@ wallet_transmit_uri (void *cls)
NFC_TIMEOUT))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Failed to send command\n");
+ "Failed to send command\n"); /* Has this
to be an error ? */
pa->task = GNUNET_SCHEDULER_add_now (&connect_target,
pa);
return;
@@ -305,7 +305,7 @@ wallet_select_aid (void *cls)
sizeof (response),
NFC_TIMEOUT))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
/* Has this to be an error ? */
"Failed to transceive with NFC app, trying to find another NFC
client\n");
pa->task = GNUNET_SCHEDULER_add_now (&connect_target,
pa);
@@ -325,8 +325,9 @@ wallet_select_aid (void *cls)
"AID selection failure, return code: %x%x, trying to find
another NFC client\n",
response[0],
response[1]);
- pa->task = GNUNET_SCHEDULER_add_now (&connect_target,
- pa);
+ pa->task = GNUNET_SCHEDULER_add_delayed(NFC_FAILURE_RETRY_FREQ,
+ &connect_target,
+ pa);
}
@@ -342,26 +343,21 @@ connect_target (void *cls)
struct PaymentActivity *pa = cls;
const nfc_modulation nmMifare[] = { {
.nmt = NMT_ISO14443A,
- .nbr = NBR_106,
+ .nbr = NBR_212,
} };
pa->task = NULL;
- if (GNUNET_YES == pa->nfc_has_target)
- {
- nfc_initiator_deselect_target (pa->pnd);
- pa->nfc_has_target = GNUNET_NO;
- }
pa->nt.nti.nai.szUidLen = 0;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Trying to find NFC client\n");
- /* NOTE: this may block for up to 5s, libnfc API sucks... */
- if (0 >= nfc_initiator_select_passive_target (pa->pnd,
- nmMifare[0],
- NULL,
- 0,
- &pa->nt))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ if( 0 > nfc_initiator_poll_target ( pa->pnd,
+ nmMifare,
+ 1,
+ 0x01,
+ 0x01,
+ &pa->nt))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, /* Has this to be
an error ? */
"Failed to connect to nfc target\n");
}
else if ( (pa->nt.nti.nai.szUidLen > UID_LEN_UPPER) ||
@@ -377,13 +373,13 @@ connect_target (void *cls)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Found NFC client\n");
- pa->nfc_has_target = GNUNET_YES;
pa->task = GNUNET_SCHEDULER_add_now (&wallet_select_aid,
pa);
return;
}
- pa->task = GNUNET_SCHEDULER_add_now (&connect_target,
- pa);
+ pa->task = GNUNET_SCHEDULER_add_delayed ( NFC_FAILURE_RETRY_FREQ,
+ &connect_target,
+ pa);
}
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [taler-taler-mdb] 15/93: fixes, (continued)
- [taler-taler-mdb] 15/93: fixes, gnunet, 2019/11/18
- [taler-taler-mdb] 14/93: updated .gitignore, gnunet, 2019/11/18
- [taler-taler-mdb] 20/93: more implementations using GNUNETUtils, gnunet, 2019/11/18
- [taler-taler-mdb] 19/93: GNUnet logs added, -h option added, gnunet, 2019/11/18
- [taler-taler-mdb] 12/93: initial indenting, gnunet, 2019/11/18
- [taler-taler-mdb] 31/93: cleanup, gnunet, 2019/11/18
- [taler-taler-mdb] 33/93: typo, gnunet, 2019/11/18
- [taler-taler-mdb] 30/93: cleanup, gnunet, 2019/11/18
- [taler-taler-mdb] 24/93: use event loop, gnunet, 2019/11/18
- [taler-taler-mdb] 32/93: retry NFC failures more nicely, gnunet, 2019/11/18
- [taler-taler-mdb] 36/93: fixed delay when cancelling, new bugs detected marked with FIXME,
gnunet <=
- [taler-taler-mdb] 46/93: first steps in configurable products, gnunet, 2019/11/18
- [taler-taler-mdb] 28/93: misc cleanup, gnunet, 2019/11/18
- [taler-taler-mdb] 45/93: first steps in configurable products, gnunet, 2019/11/18
- [taler-taler-mdb] 40/93: fix, gnunet, 2019/11/18
- [taler-taler-mdb] 43/93: preparations for QR code alternative path, gnunet, 2019/11/18
- [taler-taler-mdb] 35/93: explicitly detect not-found code, gnunet, 2019/11/18
- [taler-taler-mdb] 39/93: use test for now, gnunet, 2019/11/18
- [taler-taler-mdb] 38/93: merged, gnunet, 2019/11/18
- [taler-taler-mdb] 37/93: fixed delay when cancelling, new bugs detected marked with FIXME, gnunet, 2019/11/18
- [taler-taler-mdb] 34/93: fix, gnunet, 2019/11/18