diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/idevicedebugserverproxy.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/idevicedebugserverproxy.c b/tools/idevicedebugserverproxy.c index 9ccb3c3..475749f 100644 --- a/tools/idevicedebugserverproxy.c +++ b/tools/idevicedebugserverproxy.c | |||
| @@ -139,7 +139,7 @@ static void *thread_client_to_device(void *data) | |||
| 139 | 139 | ||
| 140 | /* spawn server to client thread */ | 140 | /* spawn server to client thread */ |
| 141 | socket_info->stop_dtoc = 0; | 141 | socket_info->stop_dtoc = 0; |
| 142 | if (thread_create(&dtoc, thread_device_to_client, data) != 0) { | 142 | if (thread_new(&dtoc, thread_device_to_client, data) != 0) { |
| 143 | fprintf(stderr, "Failed to start device to client thread...\n"); | 143 | fprintf(stderr, "Failed to start device to client thread...\n"); |
| 144 | } | 144 | } |
| 145 | 145 | ||
| @@ -187,6 +187,7 @@ static void *thread_client_to_device(void *data) | |||
| 187 | 187 | ||
| 188 | /* join other thread to allow it to stop */ | 188 | /* join other thread to allow it to stop */ |
| 189 | thread_join(dtoc); | 189 | thread_join(dtoc); |
| 190 | thread_free(dtoc); | ||
| 190 | 191 | ||
| 191 | return NULL; | 192 | return NULL; |
| 192 | } | 193 | } |
| @@ -200,12 +201,13 @@ static void* connection_handler(void* data) | |||
| 200 | 201 | ||
| 201 | /* spawn client to device thread */ | 202 | /* spawn client to device thread */ |
| 202 | socket_info->stop_ctod = 0; | 203 | socket_info->stop_ctod = 0; |
| 203 | if (thread_create(&ctod, thread_client_to_device, data) != 0) { | 204 | if (thread_new(&ctod, thread_client_to_device, data) != 0) { |
| 204 | fprintf(stderr, "Failed to start client to device thread...\n"); | 205 | fprintf(stderr, "Failed to start client to device thread...\n"); |
| 205 | } | 206 | } |
| 206 | 207 | ||
| 207 | /* join the fun */ | 208 | /* join the fun */ |
| 208 | thread_join(ctod); | 209 | thread_join(ctod); |
| 210 | thread_free(ctod); | ||
| 209 | 211 | ||
| 210 | /* shutdown client socket */ | 212 | /* shutdown client socket */ |
| 211 | socket_shutdown(socket_info->client_fd, SHUT_RDWR); | 213 | socket_shutdown(socket_info->client_fd, SHUT_RDWR); |
| @@ -348,11 +350,15 @@ int main(int argc, char *argv[]) | |||
| 348 | 350 | ||
| 349 | debug("%s: Handling new client connection...\n", __func__); | 351 | debug("%s: Handling new client connection...\n", __func__); |
| 350 | 352 | ||
| 351 | if (thread_create(&th, connection_handler, (void*)&socket_info) != 0) { | 353 | if (thread_new(&th, connection_handler, (void*)&socket_info) != 0) { |
| 352 | fprintf(stderr, "Could not start connection handler.\n"); | 354 | fprintf(stderr, "Could not start connection handler.\n"); |
| 353 | socket_shutdown(socket_info.server_fd, SHUT_RDWR); | 355 | socket_shutdown(socket_info.server_fd, SHUT_RDWR); |
| 354 | socket_close(socket_info.server_fd); | 356 | socket_close(socket_info.server_fd); |
| 357 | continue; | ||
| 355 | } | 358 | } |
| 359 | |||
| 360 | /* we do not need it anymore */ | ||
| 361 | thread_free(th); | ||
| 356 | } | 362 | } |
| 357 | 363 | ||
| 358 | debug("%s: Shutting down debugserver proxy...\n", __func__); | 364 | debug("%s: Shutting down debugserver proxy...\n", __func__); |
