Kaynağa Gözat

[fix] compare

master
extra1563 4 yıl önce
ebeveyn
işleme
7fea270178
1 değiştirilmiş dosya ile 6 ekleme ve 3 silme
  1. 6
    3
      src/broker/modules/matching.go

+ 6
- 3
src/broker/modules/matching.go Dosyayı Görüntüle

@@ -3,6 +3,7 @@ package modules
3 3
 import (
4 4
 	"errors"
5 5
 	_ "errors"
6
+	"fmt"
6 7
 	"github.com/juliangruber/go-intersect"
7 8
 	"reflect"
8 9
 )
@@ -37,7 +38,7 @@ func (moscato *Moscato) Matching(msg MsgUnit) {
37 38
 		valPtr := pos.list.head
38 39
 		for valPtr != nil {
39 40
 			compare := Compare(valPtr.val, value)
40
-			if compare < 0 { // sub.val > pub.val
41
+			if compare > 0 { // sub.val > pub.val
41 42
 				// single : { >, >= }
42 43
 
43 44
 				// (1) case : >
@@ -67,7 +68,7 @@ func (moscato *Moscato) Matching(msg MsgUnit) {
67 68
 					big = append(big, sub)
68 69
 				}
69 70
 
70
-			} else if compare > 0 { // sub.val < pub.val
71
+			} else if compare < 0 { // sub.val < pub.val
71 72
 
72 73
 				// single : { <, <= }
73 74
 
@@ -149,7 +150,9 @@ func (moscato *Moscato) Matching(msg MsgUnit) {
149 150
 			ip := sub_mng.sub2ip[sub]
150 151
 			ret = append(ret, ip)
151 152
 		}
152
-
153
+		fmt.Println("big = ", big)
154
+		fmt.Println("small = ", small)
155
+		fmt.Println("ret = ", ret)
153 156
 		moscato.MatchingManager.match_count++
154 157
 		moscato.SendQueue <- myType{ret, msg, nil}
155 158
 	}

Loading…
İptal
Kaydet