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()