pyatv icon indicating copy to clipboard operation
pyatv copied to clipboard

Feat/fire and forget remote

Open Skyline-23 opened this issue 1 month ago • 0 comments

This pull request introduces several reliability and usability improvements to the MRP protocol implementation, focusing on robust connection handling, improved command sending flexibility, and enhanced compatibility with sandboxed network environments. It also adds new tests to ensure correct behavior in these areas.

MRP Protocol Reliability and Command Handling:

  • Added robust connection checks and error handling in send and send_raw methods of MrpConnection, raising ConnectionLostError if the connection is closed or lost during send operations. [1] [2]
  • Refactored MrpProtocol to centralize connection state checks with _ensure_send_possible, ensuring proper exceptions are raised for invalid or closed states. Enhanced send and send_and_receive to handle fire-and-forget (no response) operations and propagate connection errors. [1] [2] [3]
  • Updated internal _send_command and public send_command in MrpRemoteControl to support fire-and-forget commands and custom timeouts, improving API flexibility. [1] [2] [3]

Network Compatibility Improvements:

  • Improved multicast socket setup and private address detection to work on sandboxed platforms (e.g., iOS, Docker) by probing the default IPv4 address as a fallback when no adapters are reported. [1] [2]

Testing Enhancements:

  • Added tests for fire-and-forget command sending, connection loss handling, and the new fallback network behaviors to ensure correctness and reliability. [1] [2] [3] [4]

Skyline-23 avatar Dec 07 '25 06:12 Skyline-23