[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] remover edundant call of socket.close()


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: "James Song" <jsong@xxxxxxxxxx>
  • Date: Sun, 06 Sep 2009 20:55:27 -0600
  • Delivery-date: Sun, 06 Sep 2009 19:56:07 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

Hi,
    After shutdown read and write side, sock needn't call close().  Moreover, use socket.SHUT_RDWR instead of 2 would enhace the readability of the code.

Signed-off-by: James Song <jsong@xxxxxxxxxx>

diff -r ead107bc25cb tools/python/xen/xend/XendDomain.py
--- a/tools/python/xen/xend/XendDomain.py       Fri Sep 04 08:43:05 2009 +0100
+++ b/tools/python/xen/xend/XendDomain.py       Mon Sep 07 10:33:40 2009 +0800
@@ -1353,8 +1353,7 @@
                 XendCheckpoint.save(p2cwrite, dominfo, True, live, dst,
                                     node=node)
             finally:
-                sock.shutdown(2)
-                sock.close()
+                sock.shutdown(socket.SHUT_RDWR)

             os.close(p2cread)
             os.close(p2cwrite)
@@ -1379,8 +1378,7 @@
                 XendCheckpoint.save(sock.fileno(), dominfo, True, live,
                                     dst, node=node)
             finally:
-                sock.shutdown(2)
-                sock.close()
+                sock.shutdown(socket.SHUT_RDWR)

     def domain_save(self, domid, dst, checkpoint=False):
         """Start saving a domain to file.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.