PERFORCE change 123884 for review

Andrew Turner andrew at FreeBSD.org
Sun Jul 22 08:28:58 UTC 2007


http://perforce.freebsd.org/chv.cgi?CH=123884

Change 123884 by andrew at andrew_hermies on 2007/07/22 08:28:34

	Recreate the front end communications thread after disconnection. This allows us to reconnect
	Don't die when closing the connection and the other end has already closed

Affected files ...

.. //depot/projects/soc2007/andrew-update/frontend/facund/computer.py#6 edit
.. //depot/projects/soc2007/andrew-update/frontend/facund/network/__init__.py#9 edit

Differences ...

==== //depot/projects/soc2007/andrew-update/frontend/facund/computer.py#6 (text+ko) ====

@@ -133,6 +133,7 @@
 			self.start()
 		except socket.error:
 			print "Couldn't connect to " + self.__host
+			del self.__connection
 			self.__connection = None
 
 	def disconnect(self):
@@ -141,6 +142,10 @@
 			return
 
 		self.__connection.disconnect()
+		# Wait for the thread to exit then create a new thread
+		self.join()
+		threading.Thread.__init__(self)
+		del self.__connection
 		self.__connection = None
 
 	def run(self):

==== //depot/projects/soc2007/andrew-update/frontend/facund/network/__init__.py#9 (text+ko) ====

@@ -57,7 +57,10 @@
 		if self.isReady:
 			self.isReady = False
 			# Send a connection close
-			self.socket.send("</facund-client>")
+			try:
+				self.socket.send("</facund-client>")
+			except socket.error:
+				pass
 
 			# Wait for the other end to close
 			self.__connected_lock.acquire()


More information about the p4-projects mailing list