Pārlūkot izejas kodu

[feat] Add delete when withdrawing

master
extra1563 4 gadus atpakaļ
vecāks
revīzija
e85b12bf62
1 mainītis faili ar 4 papildinājumiem un 8 dzēšanām
  1. 4
    8
      src/broker/modules/init.go

+ 4
- 8
src/broker/modules/init.go Parādīt failu

@@ -178,7 +178,7 @@ func (moscato *Moscato) Receive(msg MsgUnit) (MsgUnit, error) {
178 178
 	switch msg_type {
179 179
 
180 180
 	case KSM: //Key share msg
181
-
181
+		
182 182
 	case PM: //Publish msg
183 183
 		log.Println("PM received")
184 184
 		moscato.queue.push(moscato.preProcessMsg(msg))
@@ -214,14 +214,10 @@ func (moscato *Moscato) Receive(msg MsgUnit) (MsgUnit, error) {
214 214
 		go moscato.Send2MS(addr, newMsg)
215 215
 
216 216
 	case WM: //Withdraw msg
217
-		//ip := msg.(WithdrawMsg).From
218
-		//sublist := moscato.SubscriptionManager.ip2sub[ip]
219
-		//fmt.Println("prev list = ", sublist)
217
+		ip := msg.(WithdrawMsg).From
220 218
 		moscato.MicroServiceManager.RemoveMicroservice(msg.(WithdrawMsg).From)
221 219
 		moscato.SecureManager.RemoveSecureKey(msg.(WithdrawMsg).From)
222
-		//moscato.SubscriptionManager.delete(ip)
223
-		//sublist2 := moscato.SubscriptionManager.ip2sub[ip]
224
-		//fmt.Println("after list =", sublist2)
220
+		moscato.SubscriptionManager.delete(ip)
225 221
 
226 222
 	default:
227 223
 		return nil, errors.New("Message type Error: Not registered message type")
@@ -325,4 +321,4 @@ func Listen() {
325 321
 		conn, _ := l.Accept()
326 322
 		go rpc.ServeConn(conn)
327 323
 	}
328
-}
324
+}

Notiek ielāde…
Atcelt
Saglabāt