WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Add error handling so that disconnecting from a console

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Add error handling so that disconnecting from a console
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Wed, 27 Apr 2005 14:42:44 +0000
Delivery-date: Fri, 13 May 2005 20:03:52 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1327.2.10, 2005/04/27 15:42:44+01:00, mjw@xxxxxxxxxxxxxxxxxxx

        Add error handling so that disconnecting from a console
        producing fast output doesn't cause an error loop.
        
        Signed-off-by: Mike Wray <mike.wray@xxxxxx>



 console.py |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)


diff -Nru a/tools/python/xen/xend/server/console.py 
b/tools/python/xen/xend/server/console.py
--- a/tools/python/xen/xend/server/console.py   2005-05-13 16:04:28 -04:00
+++ b/tools/python/xen/xend/server/console.py   2005-05-13 16:04:28 -04:00
@@ -2,7 +2,8 @@
 
 import socket
 import threading
-
+from errno import EAGAIN, EINTR, EWOULDBLOCK
+    
 from xen.web import reactor, protocol
 
 from xen.lowlevel import xu
@@ -278,15 +279,20 @@
             self.lock.acquire()
             if self.closed():
                 return -1
-            if not self.conn:
-                return 0
-            while not self.obuf.empty():
+            writes = 0
+            while self.conn and (writes < 100) and (not self.obuf.empty()):
                 try:
+                    writes += 1
                     bytes = self.conn.write(self.obuf.peek())
                     if bytes > 0:
                         self.obuf.discard(bytes)
-                except socket.error:
-                    pass
+                except socket.error, err:
+                    if err.args[0] in (EWOULDBLOCK, EAGAIN, EINTR):
+                        pass
+                    else:
+                        self.disconnect()
+                        break
+                        
         finally:
             self.lock.release()
         return 0

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Add error handling so that disconnecting from a console, BitKeeper Bot <=