Changeset: c22d45d3ea7e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c22d45d3ea7e
Modified Files:
        clients/python2/monetdb/mapi.py
        clients/python3/monetdb/mapi.py
Branch: Feb2013
Log Message:

Throw exception when server unexpectedly closes connection.
This fixes bug 3228.  Thanks to Pete Hollobon.


diffs (24 lines):

diff --git a/clients/python2/monetdb/mapi.py b/clients/python2/monetdb/mapi.py
--- a/clients/python2/monetdb/mapi.py
+++ b/clients/python2/monetdb/mapi.py
@@ -229,7 +229,7 @@ class Connection(object):
         while count > 0:
             recv = self.socket.recv(count)
             if len(recv) == 0:
-                time.sleep(1)
+                raise OperationalError("Server closed connection")
             #logger.debug("II: package size: %i payload: %s" % (len(recv), 
recv))
             count -= len(recv)
             result.write(recv)
diff --git a/clients/python3/monetdb/mapi.py b/clients/python3/monetdb/mapi.py
--- a/clients/python3/monetdb/mapi.py
+++ b/clients/python3/monetdb/mapi.py
@@ -237,7 +237,7 @@ class Connection(object):
         while count > 0:
             recv = self.socket.recv(count)
             if len(recv) == 0:
-                time.sleep(1)
+                raise OperationalError("Server closed connection")
             #logger.debug("II: package size: %i payload: %s" % (len(recv), 
recv))
             count -= len(recv)
             result.write(recv)
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to