Browse Source

ncd: modules: ondemand: if restarting fails, error demands, so that we keep trying

ambrop7 14 năm trước cách đây
mục cha
commit
9db1447f0b
1 tập tin đã thay đổi với 9 bổ sung1 xóa
  1. 9 1
      ncd/modules/ondemand.c

+ 9 - 1
ncd/modules/ondemand.c

@@ -195,7 +195,15 @@ static void ondemand_process_handler (struct ondemand *o, int event)
             
             // if demands arrivied, restart process
             if (!LinkedList1_IsEmpty(&o->demands_list)) {
-                ondemand_start_process(o);
+                if (!ondemand_start_process(o)) {
+                    // error demands
+                    while (!LinkedList1_IsEmpty(&o->demands_list)) {
+                        struct demand *demand = UPPER_OBJECT(LinkedList1_GetFirst(&o->demands_list), struct demand, demands_list_node);
+                        ASSERT(demand->od == o)
+                        NCDModuleInst_Backend_SetError(demand->i);
+                        demand_free(demand);
+                    }
+                }
             }
         } break;
     }