summaryrefslogtreecommitdiff
path: root/one.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2015-04-15 19:00:26 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2015-04-15 19:00:26 -0700
commitd2503172d833d4202557e5142f90ce96dc0cda4e (patch)
tree5fac27146206d66a99053a81be34e5f97b4bc8b3 /one.cpp
parent91ca2381639bce22a02bdacf70f2ca30bdac9995 (diff)
downloadinfinitytier-d2503172d833d4202557e5142f90ce96dc0cda4e.tar.gz
infinitytier-d2503172d833d4202557e5142f90ce96dc0cda4e.zip
Add some additional detail to the peer record in CAPI and JSON control plane.
Diffstat (limited to 'one.cpp')
-rw-r--r--one.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/one.cpp b/one.cpp
index cc33a0f1..68e1fb93 100644
--- a/one.cpp
+++ b/one.cpp
@@ -675,16 +675,6 @@ int main(int argc,char **argv)
return 0; // forked
// else p == 0, so we are daemonized
}
-
- {
- // Write .pid file to home folder
- std::string pidPath(homeDir + ZT_PATH_SEPARATOR_S + ZT1_PID_PATH);
- FILE *pf = fopen(pidPath.c_str(),"w");
- if (pf) {
- fprintf(pf,"%ld",(long)getpid());
- fclose(pf);
- }
- }
#endif // __UNIX_LIKE__
#ifdef __WINDOWS__
@@ -723,6 +713,18 @@ int main(int argc,char **argv)
}
#endif // ZT_ENABLE_NETWORK_CONTROLLER
+#ifdef __UNIX_LIKE__
+ std::string pidPath(homeDir + ZT_PATH_SEPARATOR_S + ZT1_PID_PATH);
+ {
+ // Write .pid file to home folder
+ FILE *pf = fopen(pidPath.c_str(),"w");
+ if (pf) {
+ fprintf(pf,"%ld",(long)getpid());
+ fclose(pf);
+ }
+ }
+#endif // __UNIX_LIKE__
+
unsigned int returnValue = 0;
try {
@@ -762,5 +764,9 @@ int main(int argc,char **argv)
zt1Service = (OneService *)0;
delete controller;
+#ifdef __UNIX_LIKE__
+ OSUtils::rm(pidPath.c_str());
+#endif
+
return returnValue;
}