#NEWLINE# @ classmethod #NEWLINE# def __read_pp_data( cls , sock , length , initial ) : #NEWLINE# #INDENT# buf = bytearray ( length ) #NEWLINE# buf [ 0 : len ( initial ) ] = initial #NEWLINE# read = initial #NEWLINE# while ( len ( read ) < len ( buf ) ) : #NEWLINE# #INDENT# where = memoryview ( buf ) [ len ( where ) : ] #NEWLINE# read_n = sock . recv_into ( where , ( len ( buf ) - len ( read ) ) ) #NEWLINE# assert read_n , 'Received EOF during proxy protocol header' #NEWLINE# read = memoryview ( buf ) [ 0 : ( len ( read ) + read_n ) ] . tobytes ( ) #NEWLINE# #UNINDENT# return bytearray ( read )