From 905a822b057571d4467a5463741b07edbc682130 Mon Sep 17 00:00:00 2001 From: Joseph Henry Date: Tue, 7 Mar 2017 13:18:07 -0800 Subject: [PATCH] fixed vtable discrepency --- make-linux.mk | 2 +- make-mac.mk | 4 +-- src/service.cpp | 41 +++++++++++------------------- zerotierone/service/OneService.cpp | 9 +++---- zerotierone/service/OneService.hpp | 10 ++++---- 5 files changed, 27 insertions(+), 39 deletions(-) diff --git a/make-linux.mk b/make-linux.mk index 2583174..c8d4c9b 100644 --- a/make-linux.mk +++ b/make-linux.mk @@ -27,7 +27,7 @@ INCLUDES= DEFS= ARCH_FLAGS=-arch x86_64 CFLAGS= -CXXFLAGS=$(CFLAGS) -fno-rtti -std=c++11 +CXXFLAGS=$(CFLAGS) -fno-rtti -std=c++11 -DZT_SDK include objects.mk diff --git a/make-mac.mk b/make-mac.mk index 61dc907..c083d54 100644 --- a/make-mac.mk +++ b/make-mac.mk @@ -27,7 +27,7 @@ INCLUDES= DEFS= ARCH_FLAGS=-arch x86_64 CFLAGS= -CXXFLAGS=$(CFLAGS) -fno-rtti -std=c++11 +CXXFLAGS=$(CFLAGS) -fno-rtti -std=c++11 -DZT_SDK include objects.mk @@ -254,7 +254,7 @@ osx_static_lib: lwip $(OBJS) else osx_static_lib: pico $(OBJS) $(CXX) $(CXXFLAGS) $(STACK_FLAGS) $(DEFS) $(INCLUDES) $(ZTFLAGS) -DSDK_SERVICE -DSDK -DSDK_BUNDLED $(PICO_DRIVER_FILES) $(SDK_INTERCEPT_C_FILES) $(SDK_SERVICE_CPP_FILES) src/service.cpp -c - libtool -static -o build/libzt.a picotcp.o proxy.o tap.o one.o OneService.o service.o sockets.o rpc.o intercept.o OneService.o $(OBJS) + libtool -static -o build/libzt.a picotcp.o proxy.o tap.o one.o OneService.o service.o sockets.o rpc.o intercept.o $(OBJS) endif # Builds zts_* library tests diff --git a/src/service.cpp b/src/service.cpp index c851e86..d998ade 100644 --- a/src/service.cpp +++ b/src/service.cpp @@ -51,24 +51,24 @@ #include "debug.h" #include "build.h" -std::string service_path; -pthread_t intercept_thread; -int * intercept_thread_id; -pthread_key_t thr_id_key; -static ZeroTier::OneService *volatile zt1Service; - -std::string localHomeDir; // Local shortened path -std::string givenHomeDir; // What the user/application provides as a suggestion -std::string homeDir; // The resultant platform-specific dir we *must* use internally -std::string netDir; -std::string rpcNWID; - -bool rpcEnabled; - #ifdef __cplusplus extern "C" { #endif +static ZeroTier::OneService *zt1Service; + +std::string service_path; +std::string localHomeDir; // Local shortened path +std::string givenHomeDir; // What the user/application provides as a suggestion +std::string homeDir; // The resultant platform-specific dir we *must* use internally +std::string netDir; +std::string rpcNWID; + +pthread_t intercept_thread; +pthread_key_t thr_id_key; + +int * intercept_thread_id; + // ------------------------------------------------------------------------------ // --------------------------------- Base zts_* API ----------------------------- // ------------------------------------------------------------------------------ @@ -289,7 +289,6 @@ void zts_start_service(const char *path) } //void init_service_and_rpc(int key, const char * path, const char * nwid) { - // rpcEnabled = true; // rpcNWID = nwid; // init_service(key, path); //} @@ -505,17 +504,7 @@ void *zts_start_core_service(void *thread_id) { return NULL; } - //chdir(current_dir); // Return to previous current working directory (at the request of Unity3D) - #if defined(__UNITY_3D__) - DEBUG_INFO("starting service..."); - #endif - DEBUG_INFO("starting service..."); - - // Initialize RPC - // TODO: remove? - if(rpcEnabled) { - zts_init_rpc(localHomeDir.c_str(), rpcNWID.c_str()); - } + DEBUG_INFO("starting service..."); // Generate random port for new service instance unsigned int randp = 0; diff --git a/zerotierone/service/OneService.cpp b/zerotierone/service/OneService.cpp index 394e2f6..486b836 100644 --- a/zerotierone/service/OneService.cpp +++ b/zerotierone/service/OneService.cpp @@ -876,16 +876,15 @@ public: } #ifdef ZT_SDK + virtual void leave(const char *hp) + { + _node->leave(Utils::hexStrToU64(hp),NULL); + } virtual void join(const char *hp) { _node->join(Utils::hexStrToU64(hp),NULL); } - - virtual void leave(const char *hp) - { - _node->leave(Utils::hexStrToU64(hp),NULL); - } virtual std::string givenHomePath() { diff --git a/zerotierone/service/OneService.hpp b/zerotierone/service/OneService.hpp index 55dce40..6689932 100644 --- a/zerotierone/service/OneService.hpp +++ b/zerotierone/service/OneService.hpp @@ -152,15 +152,15 @@ public: #ifdef ZT_SDK /** - * Joins a network - */ - virtual void join(const char *hp) = 0; - - /** * Leaves a network */ virtual void leave(const char *hp) = 0; + /** + * Joins a network + */ + virtual void join(const char *hp) = 0; + /** * Returns the homePath given by the client application * - Used for SDK mode