diff options
-rw-r--r-- | tools/idevicewebinspectorproxy.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/idevicewebinspectorproxy.c b/tools/idevicewebinspectorproxy.c index 9d7e3e2..4d0bd40 100644 --- a/tools/idevicewebinspectorproxy.c +++ b/tools/idevicewebinspectorproxy.c @@ -29,8 +29,8 @@ #include <libimobiledevice/libimobiledevice.h> #include <libimobiledevice/webinspector.h> -#include "socket.h" -#include "thread.h" +#include "common/socket.h" +#include "common/thread.h" #define info(...) fprintf(stdout, __VA_ARGS__); fflush(stdout) #define debug(...) if(debug_mode) fprintf(stdout, __VA_ARGS__) @@ -153,7 +153,7 @@ static void *thread_client_to_device(void *data) /* spawn server to client thread */ socket_info->stop_dtoc = 0; - if (thread_create(&dtoc, thread_device_to_client, data) != 0) { + if (thread_new(&dtoc, thread_device_to_client, data) != 0) { fprintf(stderr, "Failed to start device to client thread...\n"); } @@ -200,6 +200,7 @@ static void *thread_client_to_device(void *data) /* join other thread to allow it to stop */ thread_join(dtoc); + thread_free(dtoc); return NULL; } @@ -213,12 +214,13 @@ static void* connection_handler(void* data) /* spawn client to device thread */ socket_info->stop_ctod = 0; - if (thread_create(&ctod, thread_client_to_device, data) != 0) { + if (thread_new(&ctod, thread_client_to_device, data) != 0) { fprintf(stderr, "Failed to start client to device thread...\n"); } /* join the fun */ thread_join(ctod); + thread_free(ctod); /* shutdown client socket */ socket_shutdown(socket_info->client_fd, SHUT_RDWR); @@ -312,7 +314,7 @@ int main(int argc, char **argv) } webinspector_client_t inspector = NULL; - webinspector_error_t error = webinspector_start_service(device, &inspector); + webinspector_error_t error = webinspector_client_start_service(device, &inspector, "idevicewebinspectorproxy"); if (error != WEBINSPECTOR_E_SUCCESS) { printf("Could not connect to the webinspector! Error: %i\n", error); result = EXIT_FAILURE; @@ -346,7 +348,7 @@ int main(int argc, char **argv) debug("%s: Handling new client connection...\n", __func__); - if (thread_create(&th, connection_handler, (void*)&socket_info) != 0) { + if (thread_new(&th, connection_handler, (void*)&socket_info) != 0) { fprintf(stderr, "Could not start connection handler.\n"); socket_shutdown(socket_info.server_fd, SHUT_RDWR); socket_close(socket_info.server_fd); |