On Thu, Jun 18, 2015 at 12:35 AM, FUJITA Tomonori <[email protected]> wrote: > On Mon, 15 Jun 2015 14:53:02 -0700 > Jerry Cen <[email protected]> wrote: > >> ryu/services/protocols/bgp/base.py | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/ryu/services/protocols/bgp/base.py >> b/ryu/services/protocols/bgp/base.py >> index 94c2bc9..aac0fe6 100644 >> --- a/ryu/services/protocols/bgp/base.py >> +++ b/ryu/services/protocols/bgp/base.py >> @@ -275,7 +275,7 @@ class Activity(object): >> LOG.debug('%s: Stopping child thread %s', >> self.name, thread_name) >> thread.kill() >> - del self._child_thread_map[thread_name] >> + self._child_thread_map.pop(thread_name, None) > > pop() is better than del() here? I saw cases when the key thread_name does not exist and the code crashes. pop will still succeed even if the key is not there.
Thanks for patching it in! Zhiwei > > But applied, thanks. > >> def _close_asso_sockets(self): >> """Closes all the sockets linked to this activity. >> @@ -375,11 +375,13 @@ class Activity(object): >> server = None >> for sa in listen_sockets.keys(): >> name = self.name + '_server@' + str(sa[0]) >> + self._asso_socket_map[name] = listen_sockets[sa] >> if count == 0: >> import eventlet >> server = eventlet.spawn(self._listen_socket_loop, >> listen_sockets[sa], conn_handle) >> >> + self._child_thread_map[name] = server >> count += 1 >> else: >> server = self._spawn(name, self._listen_socket_loop, >> -- >> 2.2.0.rc0.207.ga3a616c ------------------------------------------------------------------------------ _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
