Browse Source

[1828] a couple of suggested clarification comments

JINMEI Tatuya 13 years ago
parent
commit
6ad0070dab
2 changed files with 7 additions and 3 deletions
  1. 4 2
      src/bin/ddns/ddns.py.in
  2. 3 1
      src/bin/ddns/tests/ddns_test.py

+ 4 - 2
src/bin/ddns/ddns.py.in

@@ -150,10 +150,12 @@ class DDNSServer:
         Perform any cleanup that is necessary when shutting down the server.
         Do NOT call this to initialize shutdown, use trigger_shutdown().
 
-        Currently, it only causes the ModuleCCSession to send a message that
-        this module is stopping.
         '''
+        # tell the ModuleCCSession to send a message that this module is
+        # stopping.
         self._cc.send_stopping()
+        # make sure any open socket is explicitly closed, per Python
+        # convention.
         self._listen_socket.close()
 
     def accept(self):

+ 3 - 1
src/bin/ddns/tests/ddns_test.py

@@ -145,8 +145,10 @@ class TestDDNSServer(unittest.TestCase):
         self.assertIsNone(self.__hook_called)
         # Now make sure the clear_socket really works
         ddns.clear_socket()
-        ddnss.shutdown_cleanup()
         self.assertFalse(os.path.exists(ddns.SOCKET_FILE))
+        # Let ddns object complete any necessary cleanup (not part of the test,
+        # but for suppressing any warnings from the Python interpreter)
+        ddnss.shutdown_cleanup()
 
     def test_config_handler(self):
         # Config handler does not do anything yet, but should at least