Skip to content

Commit

Permalink
Call UVStream.write directly from SSLProtocol
Browse files Browse the repository at this point in the history
  • Loading branch information
taras committed Sep 9, 2024
1 parent ab16cc3 commit afe7e60
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions uvloop/handles/stream.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ cdef class UVStream(UVBaseTransport):
Py_buffer _read_pybuf
bint _read_pybuf_acquired

cpdef write(self, object buf)

# All "inline" methods are final

cdef inline _init(self, Loop loop, object protocol, Server server,
Expand Down
2 changes: 1 addition & 1 deletion uvloop/handles/stream.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ cdef class UVStream(UVBaseTransport):
self.__reading,
id(self))

def write(self, object buf):
cpdef write(self, object buf):
self._ensure_alive()

if self._eof:
Expand Down
5 changes: 4 additions & 1 deletion uvloop/sslproto.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,10 @@ cdef class SSLProtocol:
if not self._ssl_writing_paused:
data = self._outgoing_read()
if len(data):
self._transport.write(data)
if isinstance(self._transport, UVStream):
(<UVStream>self._transport).write(data)
else:
self._transport.write(data)

# Incoming flow

Expand Down

0 comments on commit afe7e60

Please sign in to comment.