Fixed hostname in statistics to properly be in packed binary format, internally.

This commit is contained in:
Thulinma 2014-10-22 16:51:51 +02:00
parent ba3880d78d
commit c26661b690
3 changed files with 16 additions and 3 deletions

View file

@ -48,7 +48,16 @@ void Controller::SharedMemStats(void * config){
/// It updates the internally saved statistics data. /// It updates the internally saved statistics data.
void Controller::statStorage::update(IPC::statExchange & data) { void Controller::statStorage::update(IPC::statExchange & data) {
if (!streamName.size()){ if (!streamName.size()){
host = data.host(); std::string tHost = data.host();
if (tHost.substr(0, 12) == std::string("\000\000\000\000\000\000\000\000\000\000\377\377", 12)){
char tmpstr[16];
snprintf(tmpstr, 16, "%hhu.%hhu.%hhu.%hhu", tHost[12], tHost[13], tHost[14], tHost[15]);
host = tmpstr;
}else{
char tmpstr[40];
snprintf(tmpstr, 40, "%0.2x%0.2x:%0.2x%0.2x:%0.2x%0.2x:%0.2x%0.2x:%0.2x%0.2x:%0.2x%0.2x:%0.2x%0.2x:%0.2x%0.2x", tHost[0], tHost[1], tHost[2], tHost[3], tHost[4], tHost[5], tHost[6], tHost[7], tHost[8], tHost[9], tHost[10], tHost[11], tHost[12], tHost[13], tHost[14], tHost[15]);
host = tmpstr;
}
streamName = data.streamName(); streamName = data.streamName();
} }
if (!connector.size()){ if (!connector.size()){

View file

@ -264,7 +264,7 @@ namespace Mist {
curData[tid].dataSize += lastPack.getDataLen(); curData[tid].dataSize += lastPack.getDataLen();
curData[tid].partNum ++; curData[tid].partNum ++;
bookKeeping[tid].curPart ++; bookKeeping[tid].curPart ++;
DEBUG_MSG(DLVL_DONTEVEN, "Track %d:%d on page %d, being part %d of key %d", lastPack.getTrackId(), lastPack.getTime(), bookKeeping[tid].first, curData[tid].partNum, curData[tid].keyNum); DEBUG_MSG(DLVL_DONTEVEN, "Track %ld:%llu on page %d, being part %d of key %d", lastPack.getTrackId(), lastPack.getTime(), bookKeeping[tid].first, curData[tid].partNum, curData[tid].keyNum);
getNext(false); getNext(false);
} }
for (std::map<int, DTSC::Track>::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++) { for (std::map<int, DTSC::Track>::iterator it = myMeta.tracks.begin(); it != myMeta.tracks.end(); it++) {

View file

@ -638,6 +638,7 @@ namespace Mist {
} }
void Output::stats(){ void Output::stats(){
static bool setHost = true;
if (!isInitialized){ if (!isInitialized){
return; return;
} }
@ -647,7 +648,10 @@ namespace Mist {
lastStats = now; lastStats = now;
IPC::statExchange tmpEx(statsPage.getData()); IPC::statExchange tmpEx(statsPage.getData());
tmpEx.now(now); tmpEx.now(now);
tmpEx.host(myConn.getHost()); if (setHost){
tmpEx.host(myConn.getBinHost());
setHost = false;
}
tmpEx.streamName(streamName); tmpEx.streamName(streamName);
tmpEx.connector(capa["name"].asString()); tmpEx.connector(capa["name"].asString());
tmpEx.up(myConn.dataUp()); tmpEx.up(myConn.dataUp());