-
Notifications
You must be signed in to change notification settings - Fork 422
Implement Connection.recv_into #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
… of the new recv_into tests.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
1 similar comment
Implement Connection.recv_into to allow receiving data with less memory copying.
No description provided.