Skip to content

Commit 6b85fd3

Browse files
committed
ssl: Micro-optimizations
1 parent 4d91264 commit 6b85fd3

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

uvloop/sslproto.pyx

+3-5
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ cdef class _SSLPipe:
131131
ssldata, appdata = self.feed_ssldata(b'')
132132
assert appdata == [] or appdata == [b'']
133133

134-
cdef feed_ssldata(self, data, only_handshake=False):
134+
cdef feed_ssldata(self, data, bint only_handshake=False):
135135
"""Feed SSL record level data into the pipe.
136136
137137
The data must be a bytes instance. It is OK to send an empty bytes
@@ -500,8 +500,7 @@ class SSLProtocol(object):
500500
self._abort()
501501
return
502502

503-
for chunk in ssldata:
504-
self._transport.write(chunk)
503+
self._transport.writelines(ssldata)
505504

506505
for chunk in appdata:
507506
if chunk:
@@ -641,8 +640,7 @@ class SSLProtocol(object):
641640
ssldata = sslpipe.shutdown(self._finalize)
642641
offset = 1
643642

644-
for chunk in ssldata:
645-
self._transport.write(chunk)
643+
self._transport.writelines(ssldata)
646644

647645
if offset < len(data):
648646
self._write_backlog[0] = (data, offset)

0 commit comments

Comments
 (0)