diff --git a/.gitignore b/.gitignore index f1e3eff..5537680 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # http://www.gnu.org/software/automake - +config.h.in Makefile.in Makefile # http://www.gnu.org/software/autoconf diff --git a/config.h.in b/config.h.in deleted file mode 100644 index 6529273..0000000 --- a/config.h.in +++ /dev/null @@ -1,100 +0,0 @@ -/* config.h.in. Generated from configure.ac by autoheader. */ - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `pthread' library (-lpthread). */ -#undef HAVE_LIBPTHREAD - -/* Define to 1 if your system has a GNU libc compatible `malloc' function, and - to 0 otherwise. */ -#undef HAVE_MALLOC - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the `memset' function. */ -#undef HAVE_MEMSET - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETDB_H - -/* Define to 1 if your system has a GNU libc compatible `realloc' function, - and to 0 otherwise. */ -#undef HAVE_REALLOC - -/* Define to 1 if you have the `socket' function. */ -#undef HAVE_SOCKET - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the `strchr' function. */ -#undef HAVE_STRCHR - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the `strstr' function. */ -#undef HAVE_STRSTR - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_SOCKET_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Name of package */ -#undef PACKAGE - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Version number of package */ -#undef VERSION - -/* Define to rpl_malloc if the replacement function should be used. */ -#undef malloc - -/* Define to rpl_realloc if the replacement function should be used. */ -#undef realloc - -/* Define to `unsigned int' if does not define. */ -#undef size_t diff --git a/wsclient.c b/wsclient.c index cccdddf..4847a9f 100644 --- a/wsclient.c +++ b/wsclient.c @@ -9,6 +9,9 @@ #include #include #include +#include + + #include @@ -65,9 +68,14 @@ void *libwsclient_run_thread(void *ptr) { } void libwsclient_finish(wsclient *client) { + //TODO: handle UNIX socket helper thread shutdown better than killing it... :P + if(client->helper_thread) { + pthread_kill(client->helper_thread, SIGINT); + } if(client->run_thread) { pthread_join(client->run_thread, NULL); } + } void libwsclient_onclose(wsclient *client, int (*cb)(wsclient *c)) { @@ -378,6 +386,7 @@ int libwsclient_helper_socket(wsclient *c, const char *path) { return WS_HELPER_CREATE_SOCK_ERR; } + if(bind(sockfd, (struct sockaddr *)&c->helper_sa, len) == -1) { fprintf(stderr, "Error binding UNIX socket.\n"); perror("bind"); @@ -409,6 +418,7 @@ void *libwsclient_helper_socket_thread(void *ptr) { for(;;) { //TODO: some way to cleanly break this loop len = sizeof(remote); + if((remote_sock = accept(c->helper_sock, (struct sockaddr *)&remote, &len)) == -1) { continue; }