From d248bc09b5ef6a46c4bcf3529bc7e0540ee18d6e Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Mon, 16 Dec 2019 11:17:20 -0800 Subject: [PATCH] added clearing streams to reset for coreclient and set event stream to be cleared --- coretk/coretk/coreclient.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/coretk/coretk/coreclient.py b/coretk/coretk/coreclient.py index 9f6900cc..b1d4d22f 100644 --- a/coretk/coretk/coreclient.py +++ b/coretk/coretk/coreclient.py @@ -85,6 +85,7 @@ class CoreClient: self.file_configs = {} self.mobility_players = {} self.handling_throughputs = None + self.handling_events = None def reset(self): # helpers @@ -101,6 +102,13 @@ class CoreClient: self.service_configs.clear() self.file_configs.clear() self.mobility_players.clear() + # clear streams + if self.handling_throughputs: + self.handling_throughputs.cancel() + self.handling_throughputs = None + if self.handling_events: + self.handling_events.cancel() + self.handling_events = None def set_observer(self, value): self.observer = value @@ -210,7 +218,9 @@ class CoreClient: response = self.client.get_session(self.session_id) session = response.session self.state = session.state - self.client.events(self.session_id, self.handle_events) + self.handling_events = self.client.events( + self.session_id, self.handle_events + ) # get location if query_location: