Skip to content

Fast-fail local photo receiver uploads#3110

Draft
PhilippeFerreiraDeSousa wants to merge 1 commit into
devfrom
codex/photo-wifi-send-fast-fail
Draft

Fast-fail local photo receiver uploads#3110
PhilippeFerreiraDeSousa wants to merge 1 commit into
devfrom
codex/photo-wifi-send-fast-fail

Conversation

@PhilippeFerreiraDeSousa

Copy link
Copy Markdown
Contributor

Summary

  • Prefer the phone's active LAN IPv4 address, and when known, an address on the same /24 as the glasses Wi-Fi IP, when the Android photo receiver publishes its upload URL.
  • Keep public webhook behavior unchanged, but use a 1s connect timeout for local/private photo receiver URLs so unreachable direct phone uploads fall back to BLE quickly instead of waiting the full 5s connect timeout.

Root Cause

Live logs showed the photo receiver and stream receiver were both advertising the phone LAN address 192.168.50.176, while the glasses were on 192.168.50.43. The photo path sent:

MentraPhotoReceiver: Photo receiver ready at http://192.168.50.176:8787/upload
BLE_TRACE ... type=take_photo ... "webhookUrl":"http:\/\/192.168.50.176:8787\/upload"

The photo then fell back through BLE:

photo_status ... "status":"ble_fallback_compression"
BlePhotoUploadService: Uploading BLE fallback photo to local receiver via loopback: http://127.0.0.1:8787/upload
photo_relay_upload_end ... "success":true,"outcome":"uploaded"

After app restart, stream failed with the same destination:

MentraGStreamer: GStreamer WHIP receiver PLAYING
BLE_TRACE ... type=start_stream ... "streamUrl":"http:\/\/192.168.50.176:8190\/whip\/endpoint"
WHIP request failed: failed to connect to /192.168.50.176 (port 8190) from /192.168.50.43 ... after 10000ms

Direct reachability checks confirmed both devices were on 192.168.50.0/24, but the glasses could not reach the phone:

phone wlan0:   192.168.50.176/24
asg wlan0:     192.168.50.43/24
ping 192.168.50.176: 2 packets transmitted, 0 received
phone nc -l -p 9999 + glasses nc -w 3 192.168.50.176 9999: nc: Timeout

So the current field failure is not photo-specific. The LAN path is unreachable for both photo upload and WHIP streaming. This PR does not pretend to fix an isolated/AP-client-isolation network; it makes the photo path choose a better receiver address when multiple interfaces exist and avoid the avoidable 5s wait before BLE fallback for local receiver URLs that cannot be reached.

Validation

  • git diff --check
  • cd asg_client && ./gradlew :app:compileDebugJavaWithJavac
  • cd mobile/modules/bluetooth-sdk && bun run build
  • cd asg_client && ANDROID_SERIAL=0123456789ABCDEF ./gradlew :app:installDebug
  • Live device log capture from phone RFCX71TH0CR and glasses 0123456789ABCDEF

cd mobile && bun compile was also run after dependency install, but it is currently blocked by unrelated existing TypeScript errors in src/services/asg/gallerySyncService.test.ts at the resolveConnectivity?.() calls.

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown

📋 PR Review Helper

📱 Mobile App Build

Ready to test! (commit a72059a)

📥 Download APK

🕶️ ASG Client Build

Build failed (commit a72059a) - View logs


🔀 Test Locally

gh pr checkout 3110

@PhilippeFerreiraDeSousa

Copy link
Copy Markdown
Contributor Author

We want this fail fast regardless of whether the web hook url is local or in the cloud

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.

1 participant