durable_rules 0.34.52 → 0.34.53

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72027204669b6fba94f9092c272f05e27e6d7b1f
4
- data.tar.gz: 377a4eb20f2ae9fb966380bdcfb1f91e72b85de4
3
+ metadata.gz: a01733997ce444fcb2910a67668c5e10b8893161
4
+ data.tar.gz: 50ee1913a41d48dcd28d7315a32ef8dffa5fb075
5
5
  SHA512:
6
- metadata.gz: 2b61ad9e9c4343ec0edaa7ebd0cc5d68c9613b206331c1d64eb31c5bde6b5f617d6a7f38ea0181a83e956edebcaa82aab5ad4ecd3d66da1bbba9202f24c621a9
7
- data.tar.gz: bd8b882feea47d4ba40f40301e310499c37f3828fb3400a9e766432faf311ca184d936099da9b424c14b073c0c3311d0b6e26f5031f1f1159e455b17962620c3
6
+ metadata.gz: '077958cc68110cfa8bf9e6354019281d112f0f1ee63b8cc295b95e85af9c9ed22dba29b8c80edb866be8c3d6f37c70bd1151257f7fe492fc49a6fdd930f31574'
7
+ data.tar.gz: 87f14ddb90146ce93cfed1eaafce9bd720e650c1d121695a324010a7b3a08e28f1d1cfd843b527e0a49b96a39e6fa856d900f00aac6dbfb0803595e3d7fbb2fb
data/src/rules/events.c CHANGED
@@ -981,6 +981,7 @@ static unsigned int isArrayMatch(ruleset *tree,
981
981
  while (top) {
982
982
  --top;
983
983
  currentAlpha = stack[top];
984
+ // add all disjunctive nodes to stack
984
985
  if (currentAlpha->nextListOffset) {
985
986
  unsigned int *nextList = &tree->nextPool[currentAlpha->nextListOffset];
986
987
  for (unsigned int entry = 0; nextList[entry] != 0; ++entry) {
@@ -1004,6 +1005,7 @@ static unsigned int isArrayMatch(ruleset *tree,
1004
1005
  }
1005
1006
  }
1006
1007
 
1008
+ // calculate conjunctive nodes
1007
1009
  if (currentAlpha->nextOffset) {
1008
1010
  unsigned int *nextHashset = &tree->nextPool[currentAlpha->nextOffset];
1009
1011
  for(unsigned int propertyIndex = 0; propertyIndex < jo.propertiesLength; ++propertyIndex) {
@@ -1013,13 +1015,14 @@ static unsigned int isArrayMatch(ruleset *tree,
1013
1015
  if (currentProperty->hash == hashNode->value.a.hash) {
1014
1016
  unsigned char match = 0;
1015
1017
  if (hashNode->value.a.operator == OP_IALL || hashNode->value.a.operator == OP_IANY) {
1018
+ // isArrayMatch finds a valid path, thus use propertyMatch
1016
1019
  result = isArrayMatch(tree,
1017
1020
  sid,
1018
1021
  message,
1019
1022
  messageObject,
1020
1023
  currentProperty,
1021
1024
  &hashNode->value.a,
1022
- &match,
1025
+ propertyMatch,
1023
1026
  rulesBinding);
1024
1027
  } else {
1025
1028
  result = isMatch(tree,
@@ -1030,31 +1033,34 @@ static unsigned int isArrayMatch(ruleset *tree,
1030
1033
  &hashNode->value.a,
1031
1034
  &match,
1032
1035
  rulesBinding);
1033
- }
1034
1036
 
1035
- if (result != RULES_OK) {
1036
- return result;
1037
- }
1037
+ if (match) {
1038
+ if (top == MAX_STACK_SIZE) {
1039
+ return ERR_MAX_STACK_SIZE;
1040
+ }
1038
1041
 
1039
- if (match) {
1040
- if (top == MAX_STACK_SIZE) {
1041
- return ERR_MAX_STACK_SIZE;
1042
+ stack[top] = &hashNode->value.a;
1043
+ ++top;
1042
1044
  }
1045
+ }
1043
1046
 
1044
- stack[top] = &hashNode->value.a;
1045
- ++top;
1047
+ if (result != RULES_OK) {
1048
+ return result;
1046
1049
  }
1047
1050
  }
1048
1051
  }
1049
1052
  }
1050
1053
  }
1051
1054
 
1052
- if ((currentAlpha->betaListOffset || !currentAlpha->nextOffset) && currentAlpha != arrayAlpha) {
1055
+ // no next offset means we found a valid path
1056
+ if (!currentAlpha->nextOffset) {
1053
1057
  *propertyMatch = 1;
1054
1058
  break;
1055
1059
  }
1056
1060
  }
1057
1061
 
1062
+ // OP_IANY, one element led a a valid path
1063
+ // OP_IALL, all elements led to a valid path
1058
1064
  if ((arrayAlpha->operator == OP_IALL && !*propertyMatch) ||
1059
1065
  (arrayAlpha->operator == OP_IANY && *propertyMatch)) {
1060
1066
  break;
@@ -1458,10 +1464,14 @@ static unsigned int handleMessages(ruleset *tree,
1458
1464
  &jo,
1459
1465
  &last) == RULES_OK) {
1460
1466
 
1461
- while (*last != ',' && *last != ']' ) {
1467
+ while (*last != ',' && *last != '\0' ) {
1462
1468
  ++last;
1463
1469
  }
1464
1470
 
1471
+ if (*last == '\0') {
1472
+ --last;
1473
+ }
1474
+
1465
1475
  lastTemp = *last;
1466
1476
  *last = '\0';
1467
1477
  result = handleMessageCore(tree,
data/src/rules/net.c CHANGED
@@ -2909,6 +2909,7 @@ unsigned int startNonBlockingBatch(void *rulesBinding,
2909
2909
  free(commands[i]);
2910
2910
  }
2911
2911
 
2912
+ sdsfree(reContext->obuf);
2912
2913
  reContext->obuf = newbuf;
2913
2914
  int wdone = 0;
2914
2915
  do {
@@ -2985,6 +2986,7 @@ unsigned int executeBatchWithReply(void *rulesBinding,
2985
2986
  free(commands[i]);
2986
2987
  }
2987
2988
 
2989
+ sdsfree(reContext->obuf);
2988
2990
  reContext->obuf = newbuf;
2989
2991
  redisReply *reply;
2990
2992
  for (unsigned int i = 0; i < replyCount; ++i) {
data/src/rules/rete.c CHANGED
@@ -816,7 +816,6 @@ static unsigned int validateRuleset(char *rules) {
816
816
  return result;
817
817
  }
818
818
  } else if (hash != HASH_COUNT && hash != HASH_PRI && hash != HASH_CAP && hash != HASH_DIST) {
819
- printf("%d\n", hash);
820
819
  return ERR_UNEXPECTED_NAME;
821
820
  }
822
821
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durable_rules
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.34.52
4
+ version: 0.34.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jesus Ruiz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-08 00:00:00.000000000 Z
11
+ date: 2018-09-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -44,28 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 4.0.1
47
+ version: '4.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 4.0.1
54
+ version: '4.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: sinatra
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 1.4.6
61
+ version: '1.4'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 1.4.6
68
+ version: '1.4'
69
69
  description: A lightweight library for real-time, consistent and scalable coordination
70
70
  of events.
71
71
  email: jr3791@live.com