Explorar el Código

[fix] 디버깅용 로그 다듬음

master
kidjung hace 4 años
padre
commit
55db4c2e31
Se han modificado 2 ficheros con 18 adiciones y 15 borrados
  1. 14
    10
      src/broker/modules/init.go
  2. 4
    5
      src/broker/modules/matching.go

+ 14
- 10
src/broker/modules/init.go Ver fichero

@@ -50,9 +50,9 @@ MS→MM
50 50
 -MmReceive에서 msgType 검사 후 그것에 맞게 msgUnit으로 MM의 Receive로 보냄
51 51
 
52 52
 -MM의 Receive에서 해당 Message를 처리
53
- */
53
+*/
54 54
 
55
-func (receiver Receiver) MmReceive(args Args, reply *Reply) error {//
55
+func (receiver Receiver) MmReceive(args Args, reply *Reply) error { //
56 56
 	// 메세지 별로 나눠서 언마샬
57 57
 	switch args.Kind {
58 58
 
@@ -155,7 +155,7 @@ func (moscato *Moscato) preProcessMsg(originalMsg MsgUnit) MsgUnit {
155 155
 func (moscato *Moscato) SendWithEncrypt() MsgUnit {
156 156
 	for {
157 157
 		mt := <-moscato.SendQueue
158
-		fmt.Println(mt)
158
+		//fmt.Println(mt)
159 159
 		if mt.err == nil {
160 160
 			for index := 0; index < len(mt.subList); index++ {
161 161
 				tmpNode := mt.subList[index]
@@ -181,11 +181,10 @@ func (moscato *Moscato) Receive(msg MsgUnit) (MsgUnit, error) {
181 181
 
182 182
 	case PM: //Publish msg
183 183
 		log.Println("PM received")
184
-		fmt.Println("PM: ", msg)
185 184
 		moscato.queue.push(moscato.preProcessMsg(msg))
186
-		fmt.Println("pushed")
187 185
 
188 186
 	case SM: //Subscription msg
187
+		log.Println("SM received")
189 188
 		err := moscato.SubscriptionManager.addSubscription(moscato.preProcessMsg(msg))
190 189
 		if err != nil {
191 190
 			println(err)
@@ -215,8 +214,14 @@ func (moscato *Moscato) Receive(msg MsgUnit) (MsgUnit, error) {
215 214
 		go moscato.Send2MS(addr, newMsg)
216 215
 
217 216
 	case WM: //Withdraw msg
217
+		//ip := msg.(WithdrawMsg).From
218
+		//sublist := moscato.SubscriptionManager.ip2sub[ip]
219
+		//fmt.Println("prev list = ", sublist)
218 220
 		moscato.MicroServiceManager.RemoveMicroservice(msg.(WithdrawMsg).From)
219 221
 		moscato.SecureManager.RemoveSecureKey(msg.(WithdrawMsg).From)
222
+		//moscato.SubscriptionManager.delete(ip)
223
+		//sublist2 := moscato.SubscriptionManager.ip2sub[ip]
224
+		//fmt.Println("after list =", sublist2)
220 225
 
221 226
 	default:
222 227
 		return nil, errors.New("Message type Error: Not registered message type")
@@ -237,7 +242,7 @@ MM→MS
237 242
 -MsReceive에서 msgType 검사 후 그것에 맞게 msgUnit으로 MS의 Receive로 보냄
238 243
 
239 244
 -MS의 Receive에서 해당 Message를 처리
240
- */
245
+*/
241 246
 
242 247
 func (moscato *Moscato) Send2MS(ipaddress string, msg MsgUnit) {
243 248
 	client, err := rpc.Dial("tcp", ipaddress+":8150")
@@ -283,7 +288,6 @@ func (moscato *Moscato) Run() {
283 288
 	go func() {
284 289
 		for {
285 290
 			msg := moscato.queue.pop(true)
286
-			fmt.Println(msg)
287 291
 			go moscato.Matching(msg)
288 292
 			go moscato.SendWithEncrypt()
289 293
 		}
@@ -305,9 +309,9 @@ func (moscato *Moscato) Run() {
305 309
 
306 310
 func Listen() {
307 311
 	/*
308
-	MS→MM일때 ⇒ port : 8160으로 열기
312
+		MS→MM일때 ⇒ port : 8160으로 열기
309 313
 
310
-	(MM이 Server, MS가 Client)
314
+		(MM이 Server, MS가 Client)
311 315
 	*/
312 316
 
313 317
 	l, err1 := net.Listen("tcp", ":8160")
@@ -321,4 +325,4 @@ func Listen() {
321 325
 		conn, _ := l.Accept()
322 326
 		go rpc.ServeConn(conn)
323 327
 	}
324
-}
328
+}

+ 4
- 5
src/broker/modules/matching.go Ver fichero

@@ -3,7 +3,6 @@ package modules
3 3
 import (
4 4
 	"errors"
5 5
 	_ "errors"
6
-	"fmt"
7 6
 	"github.com/juliangruber/go-intersect"
8 7
 	"reflect"
9 8
 )
@@ -150,10 +149,10 @@ func (moscato *Moscato) Matching(msg MsgUnit) {
150 149
 			ip := sub_mng.sub2ip[sub]
151 150
 			ret = append(ret, ip)
152 151
 		}
153
-		fmt.Println("big = ", big)
154
-		fmt.Println("small = ", small)
155
-		fmt.Println("ret = ", ret)
152
+		//fmt.Println("big = ", big)
153
+		//fmt.Println("small = ", small)
154
+		//fmt.Println("ret = ", ret)
156 155
 		moscato.MatchingManager.match_count++
157 156
 		moscato.SendQueue <- myType{ret, msg, nil}
158 157
 	}
159
-}
158
+}

Loading…
Cancelar
Guardar