Hi!. When exit from Dynagen in console mode, the qemuwrapper.py launch a exception: [Errno 32] Broken pipe
This patch prevent this. It is only decorative, make the text in the qemuwrapper console more easy to read.
Code:
diff -r -u proposal/GNS3-0.8.3.1-src/qemuwrapper/qemuwrapper.py testing/GNS3-0.8.3.1-src/qemuwrapper/qemuwrapper.py
--- proposal/GNS3-0.8.3.1-src/qemuwrapper/qemuwrapper.py 2012-11-17 00:39:16.618998040 -0300
+++ testing/GNS3-0.8.3.1-src/qemuwrapper/qemuwrapper.py 2012-11-18 13:14:21.621205858 -0300
@@ -691,6 +691,7 @@
self.handle_one_request()
while not self.close_connection:
self.handle_one_request()
+ print "Disconnection from", self.client_address
except socket.error, e:
print >> sys.stderr, e
self.request.close()
@@ -706,6 +707,9 @@
pass
return tokens
+ def finish(self):
+ pass
+
def handle_one_request(self):
debugmsg(3, "QemuWrapperRequestHandler::handle_one_request()")
request = self.rfile.readline()
@@ -719,8 +723,11 @@
# Parse request.
tokens = self.__get_tokens(request)
if len(tokens) < 2:
- self.send_reply(self.HSC_ERR_PARSING, 1,
- "At least a module and a command must be specified")
+ try:
+ self.send_reply(self.HSC_ERR_PARSING, 1,
+ "At least a module and a command must be specified")
+ except socket.error:
+ self.close_connection = 1
return
module, command = tokens[:2]
I'm not a expert python programmer, I don't know why this works, specially the 'finish()' overloaded empty method, but works for me.
Tested in Ubuntu 12.10 with Python 2.7.3 and Ubuntu 10.10 with Python 2.6.6.