@@ -400,6 +400,14 @@ bool Rule::evaluate(Transaction *trasn) {
400
400
" variable `" + v->m_key + " ' (Value: `" + value + " ' )" ;
401
401
#ifndef NO_LOGS
402
402
trasn->debug (4 , " Rule returned 1." );
403
+ trasn->m_collections .storeOrUpdateFirst (" MATCHED_VAR" ,
404
+ value);
405
+ trasn->m_collections .storeOrUpdateFirst (" MATCHED_VAR_NAME" ,
406
+ v->m_key );
407
+ trasn->m_collections .store (" MATCHED_VARS:"
408
+ + v->m_key , value);
409
+ trasn->m_collections .store (" MATCHED_VARS_NAMES:"
410
+ + v->m_key , v->m_key );
403
411
#endif
404
412
405
413
for (Action *a :
@@ -419,24 +427,7 @@ bool Rule::evaluate(Transaction *trasn) {
419
427
#ifndef NO_LOGS
420
428
trasn->debug (4 , " Executing chained rule." );
421
429
#endif
422
- if (trasn->m_collections .storeOrUpdateFirst (" MATCHED_VAR" ,
423
- value) == false ) {
424
- trasn->m_collections .store (" MATCHED_VAR" , value);
425
- }
426
- if (trasn->m_collections .storeOrUpdateFirst (
427
- " MATCHED_VAR_NAME" , v->m_key ) == false ) {
428
- trasn->m_collections .store (" MATCHED_VAR_NAME" ,
429
- v->m_key );
430
- }
431
- trasn->m_collections .store (" MATCHED_VARS:"
432
- + v->m_key , value);
433
- trasn->m_collections .store (" MATCHED_VARS_NAMES:"
434
- + v->m_key , v->m_key );
435
430
chainResult = this ->chainedRule ->evaluate (trasn);
436
- trasn->m_collections .storeOrUpdateFirst (" MATCHED_VAR" , " " );
437
- trasn->m_collections .del (" MATCHED_VARS:" + v->m_key );
438
- trasn->m_collections .del (" MATCHED_VARS_NAMES:" + v->m_key );
439
- trasn->m_collections .del (" MATCHED_VARS_NAME" );
440
431
}
441
432
if ((this ->chained && chainResult == true ) || !this ->chained ) {
442
433
for (Action *a :
@@ -509,6 +500,11 @@ bool Rule::evaluate(Transaction *trasn) {
509
500
} else {
510
501
#ifndef NO_LOGS
511
502
trasn->debug (4 , " Rule returned 0." );
503
+ trasn->m_collections .storeOrUpdateFirst (" MATCHED_VAR" , " " );
504
+ trasn->m_collections .del (" MATCHED_VARS:" + v->m_key );
505
+ trasn->m_collections .del (" MATCHED_VARS_NAMES:" + v->m_key );
506
+ trasn->m_collections .del (" MATCHED_VARS_NAME" );
507
+
512
508
#endif
513
509
}
514
510
}
0 commit comments