diff options
author | Hector Martin | 2009-04-28 02:13:12 +0200 |
---|---|---|
committer | Hector Martin | 2009-04-28 02:13:12 +0200 |
commit | c2d46d901822c54a0677318522db62f30b8d5f04 (patch) | |
tree | c98b6fa1d654db978bcd756eba954786dfe2409f /main.c | |
parent | 2f6910a012f14e132565043b7f231373f6b8cc23 (diff) | |
download | usbmuxd-c2d46d901822c54a0677318522db62f30b8d5f04.tar.gz usbmuxd-c2d46d901822c54a0677318522db62f30b8d5f04.tar.bz2 |
poll on listenfd
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -80,6 +80,7 @@ int main_loop(int listenfd) usbmuxd_log(LL_SPEW, "USB timeout is %d ms", to); fdlist_create(&pollfds); + fdlist_add(&pollfds, FD_LISTEN, listenfd, POLLIN); usb_get_fds(&pollfds); usbmuxd_log(LL_SPEW, "fd count is %d", pollfds.count); @@ -92,13 +93,15 @@ int main_loop(int listenfd) return -1; } } else { + int done_usb = 0; for(i=0; i<pollfds.count; i++) { if(pollfds.fds[i].revents) { - if(pollfds.owners[i] == FD_USB) { + if(!done_usb && pollfds.owners[i] == FD_USB) { if(usb_process() < 0) { usbmuxd_log(LL_FATAL, "usb_process() failed"); return -1; } + done_usb = 1; } } } |