stream.pxd 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. cdef enum ProtocolType:
  2. SIMPLE = 0 # User Protocol doesn't support asyncio.BufferedProtocol
  3. BUFFERED = 1 # User Protocol supports asyncio.BufferedProtocol
  4. SSL_PROTOCOL = 2 # Our own SSLProtocol
  5. cdef class UVStream(UVBaseTransport):
  6. cdef:
  7. uv.uv_shutdown_t _shutdown_req
  8. bint __shutting_down
  9. bint __reading
  10. bint __read_error_close
  11. ProtocolType __protocol_type
  12. object _protocol_get_buffer
  13. object _protocol_buffer_updated
  14. bint _eof
  15. list _buffer
  16. size_t _buffer_size
  17. Py_buffer _read_pybuf
  18. bint _read_pybuf_acquired
  19. cpdef write(self, object buf)
  20. # All "inline" methods are final
  21. cdef inline _init(self, Loop loop, object protocol, Server server,
  22. object waiter, object context)
  23. cdef inline _shutdown(self)
  24. cdef inline _accept(self, UVStream server)
  25. cdef inline _close_on_read_error(self)
  26. cdef inline __reading_started(self)
  27. cdef inline __reading_stopped(self)
  28. # The user API write() and writelines() firstly call _buffer_write() to
  29. # buffer up user data chunks, potentially multiple times in writelines(),
  30. # and then call _initiate_write() to start writing either immediately or in
  31. # the next iteration (loop._queue_write()).
  32. cdef inline _buffer_write(self, object data)
  33. cdef inline _initiate_write(self)
  34. # _exec_write() is the method that does the actual send, and _try_write()
  35. # is a fast-path used in _exec_write() to send a single chunk.
  36. cdef inline bint _exec_write(self) except -1
  37. cdef inline Py_ssize_t _try_write(self, object data) except -2
  38. cdef _close(self)
  39. cdef inline _on_accept(self)
  40. cdef inline _on_eof(self)
  41. cdef inline _on_write(self)
  42. cdef inline _on_connect(self, object exc)