Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 22 Jul 2007 08:28:57 GMT
From:      Andrew Turner <andrew@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 123884 for review
Message-ID:  <200707220828.l6M8Svai031196@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help

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

Change 123884 by andrew@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()



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200707220828.l6M8Svai031196>