diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_private-get-orders.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_private-get-orders.c | 45 |
1 files changed, 41 insertions, 4 deletions
diff --git a/src/backend/taler-merchant-httpd_private-get-orders.c b/src/backend/taler-merchant-httpd_private-get-orders.c index 8c6b12ff..85660812 100644 --- a/src/backend/taler-merchant-httpd_private-get-orders.c +++ b/src/backend/taler-merchant-httpd_private-get-orders.c @@ -444,6 +444,9 @@ resume_by_event (void *cls, osf = (enum TMH_OrderStateFlags) ntohl (oce->order_state); order_serial_id = GNUNET_ntohll (oce->order_serial_id); date = GNUNET_TIME_absolute_ntoh (oce->execution_date); + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Received notification about new order %llu\n", + (unsigned long long) order_serial_id); for (struct TMH_PendingOrder *po = mi->po_head; NULL != po; po = pn) @@ -458,23 +461,51 @@ resume_by_event (void *cls, ( ((TALER_EXCHANGE_YNA_YES == po->of.wired) == (0 != (osf & TMH_OSF_WIRED))) || (TALER_EXCHANGE_YNA_ALL == po->of.wired) ) ) ) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Client %p waits on different order type\n", + po); continue; + } if (po->of.delta > 0) { if (order_serial_id < po->of.start_row) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Client %p waits on different order row\n", + po); continue; + } if (date.abs_value_us < po->of.date.abs_value_us) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Client %p waits on different order date\n", + po); continue; + } po->of.delta--; } else { if (order_serial_id > po->of.start_row) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Client %p waits on different order row\n", + po); continue; + } if (date.abs_value_us > po->of.date.abs_value_us) + { + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Client %p waits on different order date\n", + po); continue; + } po->of.delta++; } + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Waking up client %p!\n", + po); add_order (po, NULL, order_serial_id, @@ -486,6 +517,7 @@ resume_by_event (void *cls, po->in_dll = false; GNUNET_assert (po == GNUNET_CONTAINER_heap_remove_node (po->hn)); + po->hn = NULL; MHD_resume_connection (po->con); TALER_MHD_daemon_trigger (); /* we resumed, kick MHD */ } @@ -523,6 +555,10 @@ TMH_notify_order_change (struct TMH_MerchantInstance *mi, .merchant_pub = mi->merchant_pub }; + GNUNET_log (GNUNET_ERROR_TYPE_INFO, + "Notifying clients of new order %llu at %s\n", + (unsigned long long) order_serial_id, + TALER_B2S (&mi->merchant_pub)); TMH_db->event_notify (TMH_db->cls, &eh.header, &oce, @@ -799,13 +835,14 @@ TMH_private_get_orders (const struct TMH_RequestHandler *rh, po->in_dll = true; if (NULL == mi->po_eh) { - struct GNUNET_DB_EventHeaderP change_eh = { - .type = htons (TALER_DBEVENT_MERCHANT_ORDERS_CHANGE), - .size = htons (sizeof (change_eh)) + struct TMH_OrderChangeEventP change_eh = { + .header.type = htons (TALER_DBEVENT_MERCHANT_ORDERS_CHANGE), + .header.size = htons (sizeof (change_eh)), + .merchant_pub = mi->merchant_pub }; mi->po_eh = TMH_db->event_listen (TMH_db->cls, - &change_eh, + &change_eh.header, GNUNET_TIME_UNIT_FOREVER_REL, &resume_by_event, mi); |