| 2699 | |
| 2700 | |
| 2701 | static ISC_STATUS cancel_events( rem_port* port, P_EVENT * stuff, PACKET* send) |
| 2702 | { |
| 2703 | /************************************** |
| 2704 | * |
| 2705 | * c a n c e l _ e v e n t s |
| 2706 | * |
| 2707 | ************************************** |
| 2708 | * |
| 2709 | * Functional description |
| 2710 | * Cancel events. |
| 2711 | * |
| 2712 | **************************************/ |
| 2713 | LocalStatus ls; |
| 2714 | CheckStatusWrapper status_vector(&ls); |
| 2715 | |
| 2716 | // Which database ? |
| 2717 | |
| 2718 | Rdb* rdb = port->port_context; |
| 2719 | if (bad_db(&status_vector, rdb)) |
| 2720 | return port->send_response(send, 0, 0, &status_vector, false); |
| 2721 | |
| 2722 | // Find the event |
| 2723 | |
| 2724 | Rvnt* event; |
| 2725 | for (event = rdb->rdb_events; event; event = event->rvnt_next) |
| 2726 | { |
| 2727 | if (event->rvnt_id == stuff->p_event_rid) |
| 2728 | break; |
| 2729 | } |
| 2730 | |
| 2731 | // If no event found, pretend it was cancelled |
| 2732 | |
| 2733 | if (!event) |
| 2734 | return port->send_response(send, 0, 0, &status_vector, false); |
| 2735 | |
| 2736 | // cancel the event |
| 2737 | |
| 2738 | const bool allowCancel = event->rvnt_destroyed.compareExchange(0, 1); |
| 2739 | if (allowCancel && event->rvnt_iface) |
| 2740 | { |
| 2741 | event->rvnt_iface->cancel(&status_vector); |
| 2742 | event->rvnt_iface = NULL; |
| 2743 | } |
| 2744 | |
| 2745 | // zero event info |
| 2746 | |
| 2747 | event->rvnt_id = 0L; |
| 2748 | |
| 2749 | // return response |
| 2750 | |
| 2751 | return port->send_response(send, 0, 0, &status_vector, false); |
| 2752 | } |
| 2753 | |
| 2754 | |
| 2755 | static void cancel_operation(rem_port* port, USHORT kind) |
no test coverage detected