浏览代码

Compile fixes.

Adam Ierymenko 10 年之前
父节点
当前提交
33c8d3c50b
共有 3 个文件被更改,包括 12 次插入15 次删除
  1. 0 1
      objects.mk
  2. 9 11
      one.cpp
  3. 3 3
      service/OneService.cpp

+ 0 - 1
objects.mk

@@ -22,7 +22,6 @@ OBJS=\
 	node/Switch.o \
 	node/Switch.o \
 	node/Topology.o \
 	node/Topology.o \
 	node/Utils.o \
 	node/Utils.o \
-	osdep/HttpClient.o \
 	osdep/OSUtils.o \
 	osdep/OSUtils.o \
 	service/ControlPlane.o \
 	service/ControlPlane.o \
 	service/OneService.o
 	service/OneService.o

+ 9 - 11
one.cpp

@@ -61,6 +61,7 @@
 #include "node/Identity.hpp"
 #include "node/Identity.hpp"
 #include "node/CertificateOfMembership.hpp"
 #include "node/CertificateOfMembership.hpp"
 #include "node/Utils.hpp"
 #include "node/Utils.hpp"
+#include "node/NetworkController.hpp"
 #include "osdep/OSUtils.hpp"
 #include "osdep/OSUtils.hpp"
 #include "service/OneService.hpp"
 #include "service/OneService.hpp"
 #ifdef ZT_ENABLE_NETWORK_CONTROLLER
 #ifdef ZT_ENABLE_NETWORK_CONTROLLER
@@ -110,7 +111,7 @@ static Identity getIdFromArg(char *arg)
 			return id;
 			return id;
 	} else { // identity is to be read from a file
 	} else { // identity is to be read from a file
 		std::string idser;
 		std::string idser;
-		if (Utils::readFile(arg,idser)) {
+		if (OSUtils::readFile(arg,idser)) {
 			if (id.fromString(idser))
 			if (id.fromString(idser))
 				return id;
 				return id;
 		}
 		}
@@ -134,13 +135,13 @@ int idtool(int argc,char **argv)
 		id.generate();
 		id.generate();
 		std::string idser = id.toString(true);
 		std::string idser = id.toString(true);
 		if (argc >= 3) {
 		if (argc >= 3) {
-			if (!Utils::writeFile(argv[2],idser)) {
+			if (!OSUtils::writeFile(argv[2],idser)) {
 				fprintf(stderr,"Error writing to %s"ZT_EOL_S,argv[2]);
 				fprintf(stderr,"Error writing to %s"ZT_EOL_S,argv[2]);
 				return 1;
 				return 1;
 			} else printf("%s written"ZT_EOL_S,argv[2]);
 			} else printf("%s written"ZT_EOL_S,argv[2]);
 			if (argc >= 4) {
 			if (argc >= 4) {
 				idser = id.toString(false);
 				idser = id.toString(false);
-				if (!Utils::writeFile(argv[3],idser)) {
+				if (!OSUtils::writeFile(argv[3],idser)) {
 					fprintf(stderr,"Error writing to %s"ZT_EOL_S,argv[3]);
 					fprintf(stderr,"Error writing to %s"ZT_EOL_S,argv[3]);
 					return 1;
 					return 1;
 				} else printf("%s written"ZT_EOL_S,argv[3]);
 				} else printf("%s written"ZT_EOL_S,argv[3]);
@@ -193,7 +194,7 @@ int idtool(int argc,char **argv)
 		}
 		}
 
 
 		std::string inf;
 		std::string inf;
-		if (!Utils::readFile(argv[3],inf)) {
+		if (!OSUtils::readFile(argv[3],inf)) {
 			fprintf(stderr,"%s is not readable"ZT_EOL_S,argv[3]);
 			fprintf(stderr,"%s is not readable"ZT_EOL_S,argv[3]);
 			return 1;
 			return 1;
 		}
 		}
@@ -212,7 +213,7 @@ int idtool(int argc,char **argv)
 		}
 		}
 
 
 		std::string inf;
 		std::string inf;
-		if (!Utils::readFile(argv[3],inf)) {
+		if (!OSUtils::readFile(argv[3],inf)) {
 			fprintf(stderr,"%s is not readable"ZT_EOL_S,argv[3]);
 			fprintf(stderr,"%s is not readable"ZT_EOL_S,argv[3]);
 			return 1;
 			return 1;
 		}
 		}
@@ -267,15 +268,12 @@ int idtool(int argc,char **argv)
 #ifdef __UNIX_LIKE__
 #ifdef __UNIX_LIKE__
 static void _sighandlerHup(int sig)
 static void _sighandlerHup(int sig)
 {
 {
-	Node *n = node;
-	if (n)
-		n->resync();
 }
 }
 static void _sighandlerQuit(int sig)
 static void _sighandlerQuit(int sig)
 {
 {
-	Node *n = node;
-	if (n)
-		n->terminate(Node::NODE_NORMAL_TERMINATION,"terminated by signal");
+	OneService *s = zt1Service;
+	if (s)
+		s->terminate();
 	else exit(0);
 	else exit(0);
 }
 }
 #endif
 #endif

+ 3 - 3
service/OneService.cpp

@@ -129,7 +129,7 @@ struct HttpConnection
 class OneServiceImpl : public OneService
 class OneServiceImpl : public OneService
 {
 {
 public:
 public:
-	OneServiceImpl(const char *hp,unsigned int port,NetworkConfigMaster *master,const char *overrideRootTopology) :
+	OneServiceImpl(const char *hp,unsigned int port,NetworkController *master,const char *overrideRootTopology) :
 		_homePath((hp) ? hp : "."),
 		_homePath((hp) ? hp : "."),
 		_phy(this,true),
 		_phy(this,true),
 		_master(master),
 		_master(master),
@@ -613,7 +613,7 @@ private:
 
 
 	const std::string _homePath;
 	const std::string _homePath;
 	Phy<OneServiceImpl *> _phy;
 	Phy<OneServiceImpl *> _phy;
-	NetworkConfigMaster *_master;
+	NetworkController *_master;
 	std::string _overrideRootTopology;
 	std::string _overrideRootTopology;
 	Node *_node;
 	Node *_node;
 	PhySocket *_v4UdpSocket;
 	PhySocket *_v4UdpSocket;
@@ -772,7 +772,7 @@ std::string OneService::platformDefaultHomePath()
 #endif // __UNIX_LIKE__ or not...
 #endif // __UNIX_LIKE__ or not...
 }
 }
 
 
-OneService *OneService::newInstance(const char *hp,unsigned int port,NetworkConfigMaster *master,const char *overrideRootTopology) { return new OneServiceImpl(hp,port,master,overrideRootTopology); }
+OneService *OneService::newInstance(const char *hp,unsigned int port,NetworkController *master,const char *overrideRootTopology) { return new OneServiceImpl(hp,port,master,overrideRootTopology); }
 OneService::~OneService() {}
 OneService::~OneService() {}
 
 
 } // namespace ZeroTier
 } // namespace ZeroTier