diff --git a/integrations/README.md b/integrations/README.md index ff55286..6881c23 100644 --- a/integrations/README.md +++ b/integrations/README.md @@ -14,19 +14,19 @@ For more support on these integrations, or if you'd like help creating a new int *** ## Build flags -`SDK_DEBUG` - Turns on SDK activity/warning/error output. Levels of verbosity can be adjusted in `src/SDK_Debug.h` +- `SDK_DEBUG` - Turns on SDK activity/warning/error output. Levels of verbosity can be adjusted in `src/SDK_Debug.h` -`SDK_DEBUG_LOGFILE` - Used in conjunction with `SDK_DEBUG`, this will write all SDK debug chatter to a log file. To use this, set `make SDK_DEBUG_LOGFILE=1` then `export ZT_SDK_LOGFILE=debug.log`. +- `SDK_DEBUG_LOGFILE` - Used in conjunction with `SDK_DEBUG`, this will write all SDK debug chatter to a log file. To use this, set `make SDK_DEBUG_LOGFILE=1` then `export ZT_SDK_LOGFILE=debug.log`. -`SDK_LWIP_DEBUG` - Turns on debug output for the lwIP library. +- `SDK_LWIP_DEBUG` - Turns on debug output for the lwIP library. -`SDK_BUNDLED` - Builds the SDK as a single target including an API shim, the lwIP library, and the ZeroTier service. +- `SDK_BUNDLED` - Builds the SDK as a single target including an API shim, the lwIP library, and the ZeroTier service. -`SDK_SERVICE` +- `SDK_SERVICE` -`SDK_SOCKS_PROXY` - Enables the SOCK5 Proxy. +- `SDK_SOCKS_PROXY` - Enables the SOCK5 Proxy. -`SDK_UNITY_3D` - For use when building a target for a native plugin for Unity3D. +- `SDK_UNITY_3D` - For use when building a target for a native plugin for Unity3D. *** diff --git a/src/SDK_Debug.c b/src/SDK_Debug.c index 4640911..7162cf0 100644 --- a/src/SDK_Debug.c +++ b/src/SDK_Debug.c @@ -78,6 +78,7 @@ void dwr(int level, const char *fmt, ... ) } if(debug_logfile) { FILE *file = fopen(debug_logfile,"a"); + fprintf(file, "%s [tid=%7d] ", timestring, tid); vfprintf(file, fmt, ap); fclose(file); va_end(ap); diff --git a/src/SDK_Intercept.c b/src/SDK_Intercept.c index 150fae0..7679abd 100644 --- a/src/SDK_Intercept.c +++ b/src/SDK_Intercept.c @@ -527,7 +527,7 @@ char *api_netpath; if(!check_intercept_enabled_for_thread()) { return realclose(fd); } - zt_close(fd); + return zt_close(fd); } // ------------------------------------------------------------------------------ @@ -550,7 +550,6 @@ char *api_netpath; return zt_getsockname(sockfd, addr, addrlen); } - // ------------------------------------------------------------------------------ // ------------------------------------ syscall() ------------------------------- // ------------------------------------------------------------------------------ diff --git a/tests/udp_client.c b/tests/udp_client.c index 992fac5..e3f5c22 100755 --- a/tests/udp_client.c +++ b/tests/udp_client.c @@ -14,10 +14,7 @@ int main(int argc, char * argv[]) printf("usage: udp_client \n"); return 0; } - int port = atoi(argv[1]); - - printf("cpp_udp_socket_client_test():\n"); ssize_t n_sent; int sock = -1; struct sockaddr_in server; @@ -29,7 +26,7 @@ int main(int argc, char * argv[]) return 1; } } - server.sin_addr.s_addr = inet_addr("10.5.5.2"); + server.sin_addr.s_addr = inet_addr("10.5.5.47"); server.sin_family = AF_INET; server.sin_port = htons(port); @@ -41,9 +38,7 @@ int main(int argc, char * argv[]) return 1; } - //return 1; - - // Send multiple UDP datagrams to server + // TX char data[1024]; memset(data, 0, sizeof(data)); int count = 0; diff --git a/tests/udp_server.c b/tests/udp_server.c index 113813d..e9f8614 100755 --- a/tests/udp_server.c +++ b/tests/udp_server.c @@ -1,17 +1,13 @@ // UDP Server test program -#include /* standard C i/o facilities */ -#include /* needed for atoi() */ -#include /* defines STDIN_FILENO, system calls,etc */ -#include /* system data type definitions */ -#include /* socket specific definitions */ -#include /* INET constants and stuff */ -#include /* IP address conversion stuff */ -#include /* gethostbyname */ - - - -/* this routine echos any messages (UDP datagrams) received */ +#include +#include +#include +#include +#include +#include +#include +#include #define MAXBUF 1024*1024 @@ -19,10 +15,6 @@ void echo( int sd ) { int len,n; char bufin[MAXBUF]; struct sockaddr_in remote; - - /* need to know how big address struct is, len must be set before the - call to recvfrom!!! */ - len = sizeof(remote); long count = 0;