def read()

in src/dubbo/protocol/triple/streams.py [0:0]


    def read(self, timeout: Optional[int] = None) -> Any:
        """
        Read the stream.
        :param timeout:
            The timeout in seconds. If None, it will block until the data is available.
        :type timeout: Optional[int]
        :return:
            The data read from the stream.
            If no more data, return EOF.
            If no data available within the timeout, return None.
        :rtype: Any
        """
        # If you can't read more data, return EOF
        if self._read_done and self._storage.empty():
            return EOF

        try:
            data = self._storage.get(timeout=max(0, timeout) if timeout is not None else None)
            return data
        except queue.Empty:
            return None