Thrift TTransportFactory model for servers

Summary: Servers need to create bufferedtransports etc. around the transports they get in a user-definable way. So use a factory pattern to allow the user to supply an object to the server that defines this behavior.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664792 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/py/src/transport/TSocket.py b/lib/py/src/transport/TSocket.py
index 61f1cff..2c7dd3e 100644
--- a/lib/py/src/transport/TSocket.py
+++ b/lib/py/src/transport/TSocket.py
@@ -21,8 +21,9 @@
     self.handle.connect((self.host, self.port))
 
   def close(self):
-    self.handle.close()
-    self.handle = None
+    if self.handle != None:
+      self.handle.close()
+      self.handle = None
 
   def readAll(self, sz):
     buff = ''