]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Merge remote-tracking branch 'methane/write-buffer-size'
authorBen Darnell <ben@bendarnell.com>
Sun, 25 May 2014 20:34:41 +0000 (16:34 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 25 May 2014 20:34:41 +0000 (16:34 -0400)
Conflicts:
tornado/iostream.py

1  2 
tornado/iostream.py

index cad8a6f732966aebee58905013fdd1a0a50da0dd,e0b8150332a9de34fae6dee0d22a834366c7d869..c16202a31a3d21fdb99939955590da1a964c0879
@@@ -72,15 -67,11 +72,20 @@@ class StreamClosedError(IOError)
      pass
  
  
 +class UnsatisfiableReadError(Exception):
 +    """Exception raised when a read cannot be satisfied.
 +
 +    Raised by ``read_until`` and ``read_until_regex`` with a ``max_bytes``
 +    argument.
 +    """
 +    pass
 +
 +
+ class StreamBufferFullError(IOError):
+     """Exception raised by `IOStream.write` method when write buffer is full.
+     """
  class BaseIOStream(object):
      """A utility class to write to and read from a non-blocking file or socket.
  
      `read_from_fd`, and optionally `get_fd_error`.
      """
      def __init__(self, io_loop=None, max_buffer_size=None,
-                  read_chunk_size=None):
 -                 read_chunk_size=4096, max_write_buffer_size=None):
++                 read_chunk_size=None, max_write_buffer_size=None):
          self.io_loop = io_loop or ioloop.IOLoop.current()
          self.max_buffer_size = max_buffer_size or 104857600
 -        self.read_chunk_size = read_chunk_size
 +        # A chunk size that is too close to max_buffer_size can cause
 +        # spurious failures.
 +        self.read_chunk_size = min(read_chunk_size or 65536,
 +                                   self.max_buffer_size // 2)
+         self.max_write_buffer_size = max_write_buffer_size
          self.error = None
          self._read_buffer = collections.deque()
          self._write_buffer = collections.deque()