Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tcp_forwarder: fix error handling in data causing a crash #1218

Merged
merged 1 commit into from
Oct 6, 2024

Conversation

irdkwmnsb
Copy link

@irdkwmnsb irdkwmnsb commented Sep 27, 2024

Sometimes when starting pymobiledevice3 usbmux forward 9100 9100 the process exits with an exit code = 1 when trying to connect to the socket with curl.

This happens because the socket is already closed when trying to send data back.

In my case I have a WDA WebDriverAgent running on an iOS device with an mjpeg server on port 9100
And when i try to curl it, curl closes the connection without reading the response.
The device responses, passing the data to the socket. And when it's time to pass the data to the local socket - it's already closed from the curl end, so an exception is thrown which is not suppressed (I don't know why it doesn't wright anything to stderr).

The try catch block on lines 117-127 catches the exception when writing to a closed socket.
https://github.com/doronz88/pymobiledevice3/pull/1218/files#diff-60b67652b62396a6f7dc122e1ed622712e07bd537e4b507e29edfdb873a0cd17R117-R127

pymobiledevice3/tcp_forwarder.py Show resolved Hide resolved
pymobiledevice3/tcp_forwarder.py Outdated Show resolved Hide resolved
@doronz88 doronz88 changed the title Fix usbmux sudden exit tcp_forwarder: fix error handling in data causing a crash Oct 6, 2024
@doronz88 doronz88 merged commit a11c37b into doronz88:master Oct 6, 2024
17 checks passed
@irdkwmnsb irdkwmnsb deleted the fix-tcpforwarder branch October 7, 2024 08:31
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