Skip to content

Conversation

exarkun
Copy link
Member

@exarkun exarkun commented Mar 15, 2015

No description provided.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW with cffi 0.9 the the ffi.from_buffer method would let you skip this allocation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like only in some cases. Not if the given buffer is a bytearray, for example?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I believe that's correct.

On Sun, Mar 15, 2015 at 6:05 PM, Jean-Paul Calderone <
notifications@github.com> wrote:

In OpenSSL/SSL.py
#199 (comment):

  •        buffer. If not present, defaults to the size of the buffer. If
    
  •        larger than the size of the buffer, is reduced to the size of the
    
  •        buffer.
    
  •    :param flags: (optional) Included for compatibility with the socket
    
  •        API, the value is ignored.
    
  •    :return: The number of bytes read into the buffer.
    
  •    """
    
  •    if nbytes is None:
    
  •        nbytes = len(buffer)
    
  •    else:
    
  •        nbytes = min(nbytes, len(buffer))
    
  •    # We need to create a temporary buffer. This is annoying, it would be
    
  •    # better if we could pass memoryviews straight into the SSL_read call,
    
  •    # but right now we can't. Revisit this if CFFI gets that ability.
    
  •    buf = _ffi.new("char[]", nbytes)
    

Looks like only in some cases. Not if the given buffer is a bytearray,
for example?


Reply to this email directly or view it on GitHub
https://github.com/pyca/pyopenssl/pull/199/files#r26453014.

"I disapprove of what you say, but I will defend to the death your right to
say it." -- Evelyn Beatrice Hall (summarizing Voltaire)
"The people's good is the highest law." -- Cicero
GPG Key fingerprint: 125F 5C67 DFE9 4084

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 94.52% when pulling dfe9e49 on exarkun:recv_into into b819738 on pyca:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 94.52% when pulling dfe9e49 on exarkun:recv_into into b819738 on pyca:master.

exarkun pushed a commit that referenced this pull request Mar 21, 2015
Implement Connection.recv_into to allow receiving data with less memory copying.
@exarkun exarkun merged commit 08807c9 into pyca:master Mar 21, 2015
@exarkun exarkun deleted the recv_into branch March 21, 2015 11:44
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.08%) to 94.52% when pulling 0191a18 on exarkun:recv_into into b819738 on pyca:master.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants