git-svn-id: svn://db.shs.com.ru/pip@804 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -29,21 +29,15 @@ PRIVATE_DEFINITION_END(PIIntrospectionServer)
|
||||
|
||||
PIIntrospectionServer::PIIntrospectionServer(): PIPeer(genName()) {
|
||||
PRIVATE->process_info = PIIntrospection::getInfo();
|
||||
CONNECTU(&itimer, tickEvent, this, timerEvent);
|
||||
}
|
||||
|
||||
|
||||
PIIntrospectionServer::~PIIntrospectionServer() {
|
||||
itimer.stop(false);
|
||||
if (!itimer.waitForFinish(1000)) {
|
||||
PIINTROSPECTION_CONTAINERS->p->mutex.unlock();
|
||||
}
|
||||
PIPeer::stop();
|
||||
}
|
||||
|
||||
|
||||
void PIIntrospectionServer::start() {
|
||||
itimer.start(1000);
|
||||
PIPeer::start();
|
||||
}
|
||||
|
||||
@@ -54,14 +48,24 @@ PIString PIIntrospectionServer::genName() {
|
||||
}
|
||||
|
||||
|
||||
void PIIntrospectionServer::timerEvent() {
|
||||
void PIIntrospectionServer::dataReceived(const PIString & from, const PIByteArray & data) {
|
||||
if (data.size() < 8) return;
|
||||
PIByteArray rba(data);
|
||||
uint _sign(0); rba >> _sign;
|
||||
if (_sign != PIIntrospection::sign) return;
|
||||
PIIntrospection::RequiredInfo ri;
|
||||
rba >> ri;
|
||||
PIChunkStream cs;
|
||||
cs.add(1, PIIntrospection::packInfo())
|
||||
.add(2, PIIntrospection::packContainers())
|
||||
.add(3, PIIntrospection::packThreads())
|
||||
.add(4, PIIntrospection::packObjects());
|
||||
if (ri.types[PIIntrospection::itInfo])
|
||||
cs.add(PIIntrospection::itInfo, PIIntrospection::packInfo());
|
||||
if (ri.types[PIIntrospection::itContainers])
|
||||
cs.add(PIIntrospection::itContainers, PIIntrospection::packContainers());
|
||||
if (ri.types[PIIntrospection::itThreads])
|
||||
cs.add(PIIntrospection::itThreads, PIIntrospection::packThreads());
|
||||
if (ri.types[PIIntrospection::itObjects])
|
||||
cs.add(PIIntrospection::itObjects, PIIntrospection::packObjects());
|
||||
PIByteArray ba;
|
||||
ba << PIIntrospection::sign;
|
||||
ba.append(cs.data());
|
||||
send("__introspection_client__", ba);
|
||||
send(from, ba);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user