diff options
| -rw-r--r-- | common/utils.c | 5 | ||||
| -rw-r--r-- | common/utils.h | 1 | ||||
| -rw-r--r-- | daemon/main.c | 5 |
3 files changed, 9 insertions, 2 deletions
diff --git a/common/utils.c b/common/utils.c index 6803941..f66d889 100644 --- a/common/utils.c +++ b/common/utils.c | |||
| @@ -65,6 +65,11 @@ void fdlist_free(struct fdlist *list) | |||
| 65 | list->fds = NULL; | 65 | list->fds = NULL; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | void fdlist_reset(struct fdlist *list) | ||
| 69 | { | ||
| 70 | list->count = 0; | ||
| 71 | } | ||
| 72 | |||
| 68 | void collection_init(struct collection *col) | 73 | void collection_init(struct collection *col) |
| 69 | { | 74 | { |
| 70 | col->list = malloc(sizeof(void *)); | 75 | col->list = malloc(sizeof(void *)); |
diff --git a/common/utils.h b/common/utils.h index ad4ac9d..f9cfa93 100644 --- a/common/utils.h +++ b/common/utils.h | |||
| @@ -39,6 +39,7 @@ struct fdlist { | |||
| 39 | void fdlist_create(struct fdlist *list); | 39 | void fdlist_create(struct fdlist *list); |
| 40 | void fdlist_add(struct fdlist *list, enum fdowner owner, int fd, short events); | 40 | void fdlist_add(struct fdlist *list, enum fdowner owner, int fd, short events); |
| 41 | void fdlist_free(struct fdlist *list); | 41 | void fdlist_free(struct fdlist *list); |
| 42 | void fdlist_reset(struct fdlist *list); | ||
| 42 | 43 | ||
| 43 | struct collection { | 44 | struct collection { |
| 44 | void **list; | 45 | void **list; |
diff --git a/daemon/main.c b/daemon/main.c index 893f26d..f85d034 100644 --- a/daemon/main.c +++ b/daemon/main.c | |||
| @@ -138,6 +138,7 @@ int main_loop(int listenfd) | |||
| 138 | int to, cnt, i, dto; | 138 | int to, cnt, i, dto; |
| 139 | struct fdlist pollfds; | 139 | struct fdlist pollfds; |
| 140 | 140 | ||
| 141 | fdlist_create(&pollfds); | ||
| 141 | while(!should_exit) { | 142 | while(!should_exit) { |
| 142 | usbmuxd_log(LL_FLOOD, "main_loop iteration"); | 143 | usbmuxd_log(LL_FLOOD, "main_loop iteration"); |
| 143 | to = usb_get_timeout(); | 144 | to = usb_get_timeout(); |
| @@ -147,7 +148,7 @@ int main_loop(int listenfd) | |||
| 147 | if(dto < to) | 148 | if(dto < to) |
| 148 | to = dto; | 149 | to = dto; |
| 149 | 150 | ||
| 150 | fdlist_create(&pollfds); | 151 | fdlist_reset(&pollfds); |
| 151 | fdlist_add(&pollfds, FD_LISTEN, listenfd, POLLIN); | 152 | fdlist_add(&pollfds, FD_LISTEN, listenfd, POLLIN); |
| 152 | usb_get_fds(&pollfds); | 153 | usb_get_fds(&pollfds); |
| 153 | client_get_fds(&pollfds); | 154 | client_get_fds(&pollfds); |
| @@ -201,8 +202,8 @@ int main_loop(int listenfd) | |||
| 201 | } | 202 | } |
| 202 | } | 203 | } |
| 203 | } | 204 | } |
| 204 | fdlist_free(&pollfds); | ||
| 205 | } | 205 | } |
| 206 | fdlist_free(&pollfds); | ||
| 206 | return 0; | 207 | return 0; |
| 207 | } | 208 | } |
| 208 | 209 | ||
