Skip to content

AirDrop receiver: compatibility and reliability fixes measured on real macOS - #20

Merged
brentkearney merged 2 commits into
netmojo-systems:mainfrom
aleckloiselle:pr-macos-ask
Oct 11, 2026
Merged

brentkearney merged 2 commits into
netmojo-systems:mainfrom
aleckloiselle:pr-macos-ask

Conversation

@aleckloiselle

@aleckloiselle aleckloiselle commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR now retains only the two receiver response changes:

  • Include IsAirDropable in Discover and Ask responses.
  • Advertise the Version 3 media-capabilities table captured from a MacBook Pro rather than the Version 1 codec-free stub.

Thank you to @brentkearney for reviewing these changes and confirming that a photo shared from Photos arrives as the original HEIC rather than JPEG.

Review follow-up

Removed 38516e7 (broad timeout increases) and c7ec343 (restart-policy changes), as requested. The scoped Ask-to-Upload wait is handled separately by #33. No timeout or systemd service changes remain in this PR.

The two retained commits have been recreated with aleckloiselle as their sole author and committer, without coauthor trailers. Upstream commits have not been rewritten.

Verification

On the cleaned branch, python3 -m unittest discover -s tests -p test_receiver_protocol.py -v passes all 9 tests. These launch the receiver and exercise real TLS handshakes, Discover, and Ask-to-Upload file storage. This is local protocol verification, not a new hardware timing measurement.

Fresh Ask-to-Upload timing with the omdrop-awdl#23 service-record fix remains outstanding.

@aleckloiselle aleckloiselle changed the title The Ask answer macOS decodes carries IsAirDropable AirDrop receiver: compatibility and reliability fixes measured on real macOS Sep 30, 2026
@brentkearney
brentkearney self-requested a review October 10, 2026 05:57

@brentkearney brentkearney left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the contributions!

Two of your commits carry my GitHub attribution. Since my follow-up PR (#33) replaces the timeout commit, and the restart change is on hold until the answers below, the simplest fix is to drop 38516e7 and c7ec343 from this branch. That leaves IsAirDropable and the captured media table, which I've tested: a photo shared from Photos now arrives as the original HEIC instead of a JPEG.

The timeout and restart changes need a different approach:

  • Upload wait. READ_IDLE_TIMEOUT_SECONDS covers every socket read, and INITIAL_READ_SECONDS only starts during the body, so neither one targets the wait between Ask and Upload. I've added UPLOAD_WAIT_SECONDS in a separate PR, #33. It applies only between an accepted file Ask and the start of the next request. Every other read keeps the 30 s limit, and the wait gets its own log line. Its test sends the Upload after the old 30 s limit.
  • Restart after a driver reload. Correction to what I wrote earlier: the receiver listens on the wildcard address, not on awdl0's address, so it keeps running through a reload and accepts connections on the new awdl0. A receiver that stayed down must have exited or been stopped, which the questions below should show. I'll hold the restart change until then.

Two things from your side would help:

  1. Re-measure the Ask -> Upload gap with omdrop-awdl#23, which is now merged. A cut-off service record makes the Mac drop the receiver, which could explain the gap. Across 19 transfers on a BCM4387, the Upload started within 1.5 s of the Ask.
  2. What happened to the receiver during the reload where it stayed down? A few facts would settle it:
    • Did the receiver process exit, or keep running? If it exited, how (systemd's "Main process exited" line gives the exit status or signal), and how long after the driver was unloaded?
    • Did systemd log a stop request for the unit, or a restart attempt?
    • While it was down, was anything listening on port 8771 (ss -ltnp)?

The answers to these would direct the appropriate fix. Many thanks!

Comment thread share/airdrop-receiver.service Outdated
# tripping and leave the unit failed afterwards; 30 in 300 s rides out the
# reload and still stops a genuine crash loop.
StartLimitIntervalSec=300
StartLimitBurst=30

@brentkearney brentkearney Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This no longer applies once c7ec343 is dropped. If a restart change turns out to be needed, both start-limit settings belong in [Unit]: StartLimitIntervalSec is ignored under [Service], and StartLimitBurst is only accepted there as a compatibility alias.

Comment thread bin/airdrop-serve.py Outdated
READ_IDLE_TIMEOUT_SECONDS = 30
INITIAL_READ_SECONDS = 60
READ_IDLE_TIMEOUT_SECONDS = 120
INITIAL_READ_SECONDS = 120

@brentkearney brentkearney Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This no longer applies once 38516e7 is dropped; #33 adds a scoped UPLOAD_WAIT_SECONDS instead. For context: READ_IDLE_TIMEOUT_SECONDS applies to all socket operations, so raising it also lets stalled upload bodies hold an upload slot longer. INITIAL_READ_SECONDS controls the cumulative body-progress allowance, and its clock starts during body handling, so increasing it does not extend the Ask → Upload wait.

If longer body tolerance was also intentional, please say so separately and we can look at it on its own.

@brentkearney brentkearney added the changes requested The contributor needs to change the PR before it can merge label Oct 10, 2026
Retain IsAirDropable in Discover and Ask answers alongside the receiver identity and media capabilities. Update the protocol response contract accordingly.
Replace the Version 1 codec-free stub with the Version 3 table captured from a MacBook Pro response. Preserve the captured Discover and Ask key ordering and update the receiver protocol expectation and capability documentation.
@aleckloiselle

Copy link
Copy Markdown
Contributor Author

Thank you very much for the careful review, the HEIC verification, and the scoped timeout implementation in #33. I apologize for the incorrect attribution and for drawing too strong a conclusion from the earlier reload observation.

I have removed 38516e7 and c7ec343, rebased the two retained response changes, and recreated those commits with aleckloiselle as the sole author and committer, without coauthor trailers. There are no timeout or service-unit changes left in this PR. All 9 receiver protocol tests pass on the cleaned branch, including real TLS and Ask-to-Upload storage.

I also checked the historical journal. On September 29 (local time, UTC-04:00), systemd explicitly stopped the receiver at 04:58:14. The later driver reload was at 05:11:06, and systemd started the receiver again at 05:14:31. This does not support my earlier claim that the reload killed the receiver: it was already stopped. I do not have a contemporaneous ss snapshot for that interval, so I cannot independently establish whether another process held port 8771 then. I agree that the restart-policy change should be dropped rather than justified by that observation.

The installed helper contains the corrected header calculation from omdrop-awdl#23 (total length = 4 + TLV length). A fresh hardware Ask-to-Upload measurement is still pending; I will keep that separate from the local protocol-test results. The timeout proposal was intended to address the wait before Upload, not to request a separate increase in stalled-body tolerance. Thank you again for identifying that distinction.

@brentkearney brentkearney removed the changes requested The contributor needs to change the PR before it can merge label Oct 11, 2026
@brentkearney
brentkearney self-requested a review October 11, 2026 18:18

@brentkearney brentkearney left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks Aleck, LGTM!

@brentkearney
brentkearney merged commit 284ffb0 into netmojo-systems:main Oct 11, 2026
Revoxandco pushed a commit to Revoxandco/omdrop-plugin that referenced this pull request Oct 18, 2026
manifest.json and VERSION_FALLBACK move to 0.16.0. Since 0.15.1: radio
backends other than omdrop-awdl (netmojo-systems#25), the captured media capabilities
and IsAirDropable (netmojo-systems#20), a scoped Upload wait (netmojo-systems#33), the Qt 6.12 palette
fix (netmojo-systems#42), and hardware-neutral docs and marketplace name (netmojo-systems#43). The
driver pin stays at omdrop-awdl 0.9.1, the latest release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants