Make Service communicate via empty-line-delimited Dictionary objects instead of the old size prefix way.

This commit is contained in:
Adam Ierymenko 2014-05-08 21:27:59 +00:00
parent 98f0418fb9
commit 99c5fae9da
4 changed files with 64 additions and 79 deletions

View file

@ -34,12 +34,6 @@
#include "Constants.hpp"
#include "Dictionary.hpp"
#include "Thread.hpp"
#include "Mutex.hpp"
/**
* Maximum size of a service message in bytes (sanity limit)
*/
#define ZT_SERVICE_MAX_MESSAGE_SIZE 131072
namespace ZeroTier {
@ -91,20 +85,12 @@ public:
/**
* @return Name of service
*/
inline const char *name() const
throw()
{
return _name.c_str();
}
inline const char *name() const throw() { return _name.c_str(); }
/**
* @return True if subprocess is running
*/
inline bool running() const
throw()
{
return (_pid > 0);
}
inline bool running() const throw() { return (_pid > 0); }
/**
* Thread main method; do not call elsewhere
@ -114,15 +100,19 @@ public:
private:
const RuntimeEnvironment *_r;
Thread _thread;
std::string _path;
std::string _name;
void *_arg;
void (*_handler)(void *,Service &,const Dictionary &);
long _pid;
int _childStdin;
int _childStdout;
int _childStderr;
volatile long _pid;
volatile int _childStdin;
volatile int _childStdout;
volatile int _childStderr;
volatile bool _run;
};
#endif // __WINDOWS__