Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Add support for driving BufferedProtocol instances using sock_recv_into #60

Merged
merged 8 commits into from
May 4, 2024

Conversation

ntninja
Copy link
Contributor

@ntninja ntninja commented Oct 13, 2022

Support for this feature is emulated for the Pipe{Read,Write}Transport however, since glib.IOChannel does not appear to expose anything similar to the recvinto syscall in its APIs. The emulation at least makes it possible to use BufferedProtocol instances without causing crashes due to API differences versus the classic Protocol interface at least.

Refs #58
Fixes #116

PR Checklist:

  • All new features have been tested – no test code
  • All new features have been documented(ish)
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

…_into`

Support for this feature is emulated for the `Pipe{Read,Write}Transport`
however, since `glib.IOChannel` does not appear to expose anything similar
to the `recvinto` syscall in its APIs. The emulation at least makes it possible
to use `BufferedProtocol` instances without causing crashes due to API
differences versus the classic `Protocol` interface at least.
assert isinstance(data, bytes)
if data != b"" and data != 0:
if self._alloc_read_buffers:
#FIXME: GLib does not actually expose the equivalent to
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: This line caused flake8 to cry with error E265, because there is no space between the hash sign and the word FIXME…

@ntninja
Copy link
Contributor Author

ntninja commented Nov 5, 2022

(CI passes now, but I had to disable the broken towncrier check.)

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR (and apologies for the delay in reviewing; I apparently didn't have this repo on my Github Watch list).

I've corrected the problem with the Towncrier configuration; and this PR looks reasonable from a first-pass review. However, in order to be merged, it requires tests for the new functionality.

Copy link
Member

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

I'd feel a lot better if this had tests; but empirical testing shows that it resolves #116, and the perfect is the enemy of the good, so I'll merge it. Thanks for the PR; apologies for taking so long to get to merging it.

@freakboy3742 freakboy3742 merged commit a2304bd into beeware:main May 4, 2024
9 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AttributeError when using aiohttp
2 participants