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

@ntninja ntninja force-pushed the feat-buffered-protocols branch from 2e48902 to 5aee5a5 Compare October 13, 2022 00:03
@ntninja ntninja force-pushed the feat-buffered-protocols branch from 1ffbc38 to c901d10 Compare November 4, 2022 23:59
@ntninja ntninja force-pushed the feat-buffered-protocols branch from c901d10 to 87a14a5 Compare November 5, 2022 00:02
…_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.
@ntninja ntninja force-pushed the feat-buffered-protocols branch from 87a14a5 to 74a3ec4 Compare November 5, 2022 00:04
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