From: Mukund Sivaraman Date: Fri, 5 Jul 2013 11:10:32 +0000 (+0530) Subject: [2856] Pass tuples in the command queue X-Git-Tag: bind10-1.2.0beta1-release~306^2~35 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e29189407016909a302b2c7d4e9fb77f2ffb50e2;p=thirdparty%2Fkea.git [2856] Pass tuples in the command queue --- diff --git a/src/bin/memmgr/memmgr.py.in b/src/bin/memmgr/memmgr.py.in index 5c9040f083..4bf27fe9a5 100755 --- a/src/bin/memmgr/memmgr.py.in +++ b/src/bin/memmgr/memmgr.py.in @@ -162,7 +162,7 @@ class Memmgr(BIND10Server): # This makes the MemorySegmentBuilder exit its main loop. It # should make the builder thread joinable. with self._builder_cv: - self._builder_command_queue.append('shutdown') + self._builder_command_queue.append(('shutdown',)) self._builder_cv.notify_all() self._builder_thread.join() diff --git a/src/lib/python/isc/memmgr/builder.py b/src/lib/python/isc/memmgr/builder.py index 317ae48324..eb196153fe 100644 --- a/src/lib/python/isc/memmgr/builder.py +++ b/src/lib/python/isc/memmgr/builder.py @@ -85,7 +85,8 @@ class MemorySegmentBuilder: # Run commands passed in the command queue sequentially # in the given order. For now, it only supports the # "shutdown" command, which just exits the thread. - for command in local_command_queue: + for command_tuple in local_command_queue: + command = command_tuple[0] if command == 'shutdown': self.__handle_shutdown() # When the shutdown command is received, we do diff --git a/src/lib/python/isc/memmgr/tests/builder_tests.py b/src/lib/python/isc/memmgr/tests/builder_tests.py index 328fd747c2..94cb8e1e3d 100644 --- a/src/lib/python/isc/memmgr/tests/builder_tests.py +++ b/src/lib/python/isc/memmgr/tests/builder_tests.py @@ -58,7 +58,7 @@ class TestMemorySegmentBuilder(unittest.TestCase): # Now that the builder thread is running, send it a bad # command. The thread should exit its main loop and be joinable. with self._builder_cv: - self._builder_command_queue.append('bad_command') + self._builder_command_queue.append(('bad_command',)) self._builder_cv.notify_all() # Wait 5 seconds to receive a notification on the socket from @@ -98,10 +98,10 @@ class TestMemorySegmentBuilder(unittest.TestCase): # Now that the builder thread is running, send it the shutdown # command. The thread should exit its main loop and be joinable. with self._builder_cv: - self._builder_command_queue.append('shutdown') + self._builder_command_queue.append(('shutdown',)) # Commands after 'shutdown' must be ignored. - self._builder_command_queue.append('bad_command_1') - self._builder_command_queue.append('bad_command_2') + self._builder_command_queue.append(('bad_command_1',)) + self._builder_command_queue.append(('bad_command_2',)) self._builder_cv.notify_all() # Wait 5 seconds at most for the main loop of the builder to