@@ -355,7 +355,7 @@ cdef class SSLProtocol:
355355 self ._handshake_timeout_handle.cancel()
356356 self ._handshake_timeout_handle = None
357357
358- cdef get_buffer_c (self , size_t n, char ** buf, size_t* buf_size):
358+ cdef get_buffer_impl (self , size_t n, char ** buf, size_t* buf_size):
359359 cdef size_t want = n
360360 if want > SSL_READ_MAX_SIZE:
361361 want = SSL_READ_MAX_SIZE
@@ -368,17 +368,7 @@ cdef class SSLProtocol:
368368 buf[0 ] = self ._ssl_buffer
369369 buf_size[0 ] = self ._ssl_buffer_len
370370
371- def get_buffer (self , size_t n ):
372- # This pure python call is still used by some very peculiar test cases
373-
374- cdef:
375- char * buf
376- size_t buf_size
377-
378- self .get_buffer_c(n, & buf, & buf_size)
379- return PyMemoryView_FromMemory(buf, buf_size, PyBUF_WRITE)
380-
381- def buffer_updated (self , size_t nbytes ):
371+ cdef buffer_updated_impl(self , size_t nbytes):
382372 self ._incoming_write(PyMemoryView_FromMemory(
383373 self ._ssl_buffer, nbytes, PyBUF_WRITE))
384374
@@ -394,6 +384,18 @@ cdef class SSLProtocol:
394384 elif self ._state == SHUTDOWN:
395385 self ._do_shutdown()
396386
387+ def get_buffer (self , size_t n ):
388+ # This pure python call is still used by some very peculiar test cases
389+ cdef:
390+ char * buf
391+ size_t buf_size
392+
393+ self .get_buffer_impl(n, & buf, & buf_size)
394+ return PyMemoryView_FromMemory(buf, buf_size, PyBUF_WRITE)
395+
396+ def buffer_updated (self , size_t nbytes ):
397+ self .buffer_updated_impl(nbytes)
398+
397399 def eof_received (self ):
398400 """ Called when the other end of the low-level stream
399401 is half-closed.
@@ -546,6 +548,7 @@ cdef class SSLProtocol:
546548 if self ._app_state == STATE_INIT:
547549 self ._app_state = STATE_CON_MADE
548550 self ._app_protocol.connection_made(self ._get_app_transport())
551+
549552 self ._wakeup_waiter()
550553
551554 # We should wakeup user code before sending the first data below. In
@@ -558,7 +561,7 @@ cdef class SSLProtocol:
558561 new_MethodHandle(self ._loop,
559562 " SSLProtocol._do_read" ,
560563 < method_t> self ._do_read,
561- None , # current context is good
564+ None ,
562565 self ))
563566
564567 # Shutdown flow
@@ -758,7 +761,7 @@ cdef class SSLProtocol:
758761 new_MethodHandle(self ._loop,
759762 " SSLProtocol._do_read" ,
760763 < method_t> self ._do_read,
761- None , # current context is good
764+ None ,
762765 self ))
763766 except ssl_SSLAgainErrors as exc:
764767 pass
@@ -794,10 +797,12 @@ cdef class SSLProtocol:
794797 data.append(chunk)
795798 except ssl_SSLAgainErrors as exc:
796799 pass
800+
797801 if one:
798802 self ._app_protocol.data_received(first)
799803 elif not zero:
800804 self ._app_protocol.data_received(b' ' .join(data))
805+
801806 if not chunk:
802807 # close_notify
803808 self ._call_eof_received()
@@ -887,11 +892,12 @@ cdef class SSLProtocol:
887892 self ._app_reading_paused = False
888893 if self ._state == WRAPPED:
889894 self ._loop._call_soon_handle(
890- new_MethodHandle(self ._loop,
891- " SSLProtocol._do_read" ,
892- < method_t> self ._do_read,
893- context,
894- self ))
895+ new_MethodHandle1(self ._loop,
896+ " SSLProtocol._do_read" ,
897+ < method1_t> self ._do_read,
898+ context,
899+ self ,
900+ context))
895901
896902 # Flow control for reads from SSL socket
897903
0 commit comments