Revision 6096ee13 lib/luxi.py

b/lib/luxi.py
186 186
      raise EncodingError("Message terminator found in payload")
187 187
    self._CheckSocket()
188 188
    try:
189
      # TODO: sendall is not guaranteed to send everything
189 190
      self.socket.sendall(msg + self.eom)
190 191
    except socket.timeout, err:
191 192
      raise TimeoutError("Sending timeout: %s" % str(err))
......
204 205
    while not self._msgs:
205 206
      if time.time() > etime:
206 207
        raise TimeoutError("Extended receive timeout")
207
      try:
208
        data = self.socket.recv(4096)
209
      except socket.timeout, err:
210
        raise TimeoutError("Receive timeout: %s" % str(err))
208
      while True:
209
        try:
210
          data = self.socket.recv(4096)
211
        except socket.error, err:
212
          if err.args and err.args[0] == errno.EAGAIN:
213
            continue
214
          raise
215
        except socket.timeout, err:
216
          raise TimeoutError("Receive timeout: %s" % str(err))
217
        break
211 218
      if not data:
212 219
        raise ConnectionClosedError("Connection closed while reading")
213 220
      new_msgs = (self._buffer + data).split(self.eom)

Also available in: Unified diff