summaryrefslogtreecommitdiffstats
path: root/docs/inetcat.1
diff options
context:
space:
mode:
authorGravatar Sorvigolova2026-10-21 20:56:59 +0400
committerGravatar Nikias Bassen2026-11-15 15:12:49 +0100
commite478ab408ed8db9003a25fe166e87237ba149dfd (patch)
tree0a91fc673e228d00f92c5c81627629fd8b9f527a /docs/inetcat.1
parent78d4e4c673dbc4bc70ed81fe096eb54b844f0030 (diff)
downloadlibusbmuxd-e478ab408ed8db9003a25fe166e87237ba149dfd.tar.gz
libusbmuxd-e478ab408ed8db9003a25fe166e87237ba149dfd.tar.bz2
Fix hang in usbmuxd_events_unsubscribe() right after subscribing
If usbmuxd_events_unsubscribe() is called before the device monitor thread has connected to usbmuxd, listenfd is still -1, so there is nothing to shut down. Where thread_cancel() is not available (Windows, or builds without pthread_cancel) unsubscribe then relies on clearing `running`, but device_monitor() sets `running = 1` and `cancelling = 0` itself when it starts and overwrites that. The thread goes on to connect, sends Listen and blocks in receive_packet() forever, so thread_join() never returns. This is easy to hit with ideviceinstaller on Windows with a network device and redirected stdout: the command completes before idevice_wait_for_command_to_complete() subscribes, so subscribe and unsubscribe happen back to back and the tool hangs on exit. Fix this by: - initializing `running`/`cancelling` in usbmuxd_events_subscribe() under listener_mutex before the monitor thread is created; - publishing listenfd in device_monitor() under the same mutex, and only if no cancellation was requested in the meantime (otherwise close the new socket and exit); - setting `cancelling`/`running` and shutting down listenfd under the mutex in usbmuxd_events_unsubscribe(), and only if the socket exists.
Diffstat (limited to 'docs/inetcat.1')
0 files changed, 0 insertions, 0 deletions