diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/Makefile.am | 8 | ||||
| -rw-r--r-- | tools/inetcat.c | 2 | ||||
| -rw-r--r-- | tools/iproxy.c | 26 | 
3 files changed, 14 insertions, 22 deletions
| diff --git a/tools/Makefile.am b/tools/Makefile.am index 1afaf82..bab9ba8 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,15 +1,15 @@ -AM_CFLAGS = $(GLOBAL_CFLAGS) -I$(top_srcdir)/common -I$(top_srcdir)/src -I$(top_srcdir)/include -AM_LDFLAGS = $(libpthread_LIBS) +AM_CFLAGS = $(GLOBAL_CFLAGS) -I$(top_srcdir)/src -I$(top_srcdir)/include $(limd_glue_CFLAGS) +AM_LDFLAGS = $(libpthread_LIBS) $(limd_glue_LIBS)  bin_PROGRAMS = iproxy inetcat  iproxy_SOURCES = iproxy.c  iproxy_CFLAGS = $(AM_CFLAGS)  iproxy_LDFLAGS = $(AM_LDFLAGS) -iproxy_LDADD = $(top_builddir)/src/libusbmuxd-2.0.la $(top_builddir)/common/libinternalcommon.la +iproxy_LDADD = $(top_builddir)/src/libusbmuxd-2.0.la  inetcat_SOURCES = inetcat.c  inetcat_CFLAGS = $(AM_CFLAGS)  inetcat_LDFLAGS = $(AM_LDFLAGS) -inetcat_LDADD = $(top_builddir)/src/libusbmuxd-2.0.la $(top_builddir)/common/libinternalcommon.la +inetcat_LDADD = $(top_builddir)/src/libusbmuxd-2.0.la diff --git a/tools/inetcat.c b/tools/inetcat.c index e4848c1..eb5e411 100644 --- a/tools/inetcat.c +++ b/tools/inetcat.c @@ -48,7 +48,7 @@  #endif  #include "usbmuxd.h" -#include "socket.h" +#include <libimobiledevice-glue/socket.h>  static int debug_level = 0; diff --git a/tools/iproxy.c b/tools/iproxy.c index bd56ebd..fd96f2d 100644 --- a/tools/iproxy.c +++ b/tools/iproxy.c @@ -44,13 +44,10 @@ typedef unsigned int socklen_t;  #else  #include <sys/select.h>  #include <sys/socket.h> -#include <sys/un.h> -#include <arpa/inet.h> -#include <pthread.h> -#include <netinet/in.h>  #include <signal.h>  #endif -#include "socket.h" +#include <libimobiledevice-glue/socket.h> +#include <libimobiledevice-glue/thread.h>  #include "usbmuxd.h"  #ifndef ETIMEDOUT @@ -450,11 +447,7 @@ int main(int argc, char **argv)  		}  		for (i = 0; i < num_listen; i++) {  			if (FD_ISSET(listen_sock[i].fd, &read_fds)) { -#ifdef WIN32 -				HANDLE acceptor = NULL; -#else -				pthread_t acceptor; -#endif +				THREAD_T acceptor = THREAD_T_NULL;  				struct client_data *cdata;  				int c_sock = socket_accept(listen_sock[i].fd, listen_port[listen_sock[i].index]);  				if (c_sock < 0) { @@ -474,13 +467,12 @@ int main(int argc, char **argv)  				cdata->udid = (device_udid) ? strdup(device_udid) : NULL;  				cdata->lookup_opts = lookup_opts;  				cdata->device_port = device_port[listen_sock[i].index]; -#ifdef WIN32 -				acceptor = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)acceptor_thread, cdata, 0, NULL); -				CloseHandle(acceptor); -#else -				pthread_create(&acceptor, NULL, acceptor_thread, cdata); -				pthread_detach(acceptor); -#endif + +				if (thread_new(&acceptor, acceptor_thread, cdata) == 0) { +					thread_detach(acceptor); +				} else { +					fprintf(stderr, "ERROR: Failed to created acceptor thread!\n"); +				}  			}  		}  	} | 
