Skip to content

Get full response from PulseAudio server#33360

Closed
breiti wants to merge 2 commits intohome-assistant:devfrom
breiti:pulse-select
Closed

Get full response from PulseAudio server#33360
breiti wants to merge 2 commits intohome-assistant:devfrom
breiti:pulse-select

Conversation

@breiti
Copy link
Copy Markdown
Contributor

@breiti breiti commented Mar 28, 2020

Proposed change

For larger responses from the PulseAudio server there's a chance that
recv() is called before the data has been received, leaving us with a
truncated result as the remaining text to be received is silently
ignored.

This change makes sure that all data received until the configured tcp
timeout elapses is evaluated, at the cost of making all requests that
expect a result slower.

Note that the result text contains information about the number of
modules loaded, which should make it possible to determine when the
returned text ends without waiting for the timeout. Until this is fixed,
this changes makes the behavior more reliable.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@homeassistant
Copy link
Copy Markdown
Contributor

Hi @breiti,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

For larger responses from the PulseAudio server there's a chance that
recv() is called before the data has been received, leaving us with a
truncated result as the remaining text to be received is silently
ignored.

This change makes sure that all data received until the configured tcp
timeout elapses is evaluated, at the cost of making all requests that
expect a result slower.

Note that the result text contains information about the number of
modules loaded, which should make it possible to determine when the
returned text ends without waiting for the timeout. Until this is fixed,
this change makes the behavior more reliable.
The response from PulseAudio server for the 'list modules' command
states how many modules are loaded right at the beginning.  We can use
this information to detect when all modules haven been received and
prevent the need to wait until the tcp timeout occurs.
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare 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. Unfortunately we can't accept any (big) changes to this integration until the device specific interface code has been extracted to a 3rd party library.

Comment thread homeassistant/components/pulseaudio_loopback/switch.py
@breiti
Copy link
Copy Markdown
Contributor Author

breiti commented Apr 30, 2020

Extracting library in #34965, making this PR obsolete.

@breiti breiti closed this Apr 30, 2020
@lock lock Bot locked and limited conversation to collaborators May 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants