Переглянути джерело

[feat] Add delete when withdrawing

master
extra1563 4 роки тому
джерело
коміт
e85b12bf62
1 змінених файлів з 4 додано та 8 видалено
  1. 4
    8
      src/broker/modules/init.go

+ 4
- 8
src/broker/modules/init.go Переглянути файл

178
 	switch msg_type {
178
 	switch msg_type {
179
 
179
 
180
 	case KSM: //Key share msg
180
 	case KSM: //Key share msg
181
-
181
+		
182
 	case PM: //Publish msg
182
 	case PM: //Publish msg
183
 		log.Println("PM received")
183
 		log.Println("PM received")
184
 		moscato.queue.push(moscato.preProcessMsg(msg))
184
 		moscato.queue.push(moscato.preProcessMsg(msg))
214
 		go moscato.Send2MS(addr, newMsg)
214
 		go moscato.Send2MS(addr, newMsg)
215
 
215
 
216
 	case WM: //Withdraw msg
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
 		moscato.MicroServiceManager.RemoveMicroservice(msg.(WithdrawMsg).From)
218
 		moscato.MicroServiceManager.RemoveMicroservice(msg.(WithdrawMsg).From)
221
 		moscato.SecureManager.RemoveSecureKey(msg.(WithdrawMsg).From)
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
 	default:
222
 	default:
227
 		return nil, errors.New("Message type Error: Not registered message type")
223
 		return nil, errors.New("Message type Error: Not registered message type")
325
 		conn, _ := l.Accept()
321
 		conn, _ := l.Accept()
326
 		go rpc.ServeConn(conn)
322
 		go rpc.ServeConn(conn)
327
 	}
323
 	}
328
-}
324
+}

Завантаження…
Відмінити
Зберегти