[Uludag-commits] r10086 - trunk/comar/api/comar

svn-uludag at uludag.org.tr svn-uludag at uludag.org.tr
2 Kas 2006 Per 10:38:56 EET


Author: gurer
Date: Thu Nov  2 10:38:56 2006
New Revision: 10086

Modified:
   trunk/comar/api/comar/__init__.py
Log:
fixy #1


Modified: trunk/comar/api/comar/__init__.py
=================================================================
--- trunk/comar/api/comar/__init__.py	(original)
+++ trunk/comar/api/comar/__init__.py	Thu Nov  2 10:38:56 2006
@@ -131,7 +131,7 @@
         return pak
     
     def read(self):
-        """Read a reply from comard.
+        """Read a reply from comar.
         
         If there isn't any data waiting at connection, this function
         immediately returns None. If there is data, returned value
@@ -159,19 +159,15 @@
         if fds[0] == []:
             return None
         try:
-            data = self.sock.recv(8)
-            if len(data) < 8:
-                raise RuntimeException("borkbork1 %d" % len(data))
+            data = self.sock.recv(8, socket.MSG_WAITALL)
         except:
-            raise Error('Connection closed')
+            raise
         head = struct.unpack('!ii', str(data))
         cmd = head[0] >> 24
         size = head[0] & 0x00ffffff
         if size:
             try:
                 data = self.sock.recv(size, socket.MSG_WAITALL)
-                if len(data) < size:
-                    raise RuntimeException("borkbork2 %d %d" % (size, len(data)))
             except:
                 raise Error('Connection closed')
         else:
@@ -180,15 +176,13 @@
         return Reply(cmd, head[1], data)
     
     def read_cmd(self):
-        """Read a reply from comard.
+        """Read a reply from comar.
         
         This method behaves like read method, except that it waits until
         a full message comes from the COMAR daemon.
         """
         while 1:
             fds = select.select([self.sock], [], [])
-            if len(fds) != 3:
-                raise RuntimeException("borkbork3 %d" % len(fds))
             if fds[0] != []:
                 break
         return self.read()
@@ -196,7 +190,7 @@
     def localize(self, localename=None):
         """Set the language for translated replies.
         
-        Since comard has no way to detect caller's locale, this command
+        Since comar has no way to detect caller's locale, this command
         is used for sending user's language to the comard. Afterwards,
         all the jobs started with API calls uses translated messages in
         their replies.


Uludag-commits mesaj listesiyle ilgili daha fazla bilgi