----------------------------------------------------------------------------- Queue an item on the query queue that indicates a stage is complete -----------------------------------------------------------------------------
| 7425 | // Queue an item on the query queue that indicates a stage is complete |
| 7426 | //----------------------------------------------------------------------------- |
| 7427 | void Driver::ReloadNode |
| 7428 | ( |
| 7429 | uint8 const _nodeId |
| 7430 | ) |
| 7431 | { |
| 7432 | LockGuard LG(m_nodeMutex); |
| 7433 | Log::Write( LogLevel_Detail, _nodeId, "Reloading Node"); |
| 7434 | /* delete any cached information about this node so we start from fresh */ |
| 7435 | char str[32]; |
| 7436 | int32 intVal; |
| 7437 | |
| 7438 | string userPath; |
| 7439 | Options::Get()->GetOptionAsString( "UserPath", &userPath ); |
| 7440 | |
| 7441 | snprintf( str, sizeof(str), "ozwcache_0x%08x.xml", m_homeId ); |
| 7442 | string filename = userPath + string(str); |
| 7443 | |
| 7444 | TiXmlDocument doc; |
| 7445 | if( doc.LoadFile( filename.c_str(), TIXML_ENCODING_UTF8 ) ) |
| 7446 | { |
| 7447 | doc.SetUserData((void *)filename.c_str()); |
| 7448 | TiXmlElement * driverElement = doc.RootElement(); |
| 7449 | |
| 7450 | TiXmlNode * nodeElement = driverElement->FirstChild(); |
| 7451 | while( nodeElement ) |
| 7452 | { |
| 7453 | if (nodeElement->ToElement()) { |
| 7454 | char const* str2 = nodeElement->ToElement()->Value(); |
| 7455 | if( str2 && !strcmp( str2, "Node" ) ) |
| 7456 | { |
| 7457 | // Get the node Id from the XML |
| 7458 | if( TIXML_SUCCESS == nodeElement->ToElement()->QueryIntAttribute( "id", &intVal ) ) |
| 7459 | { |
| 7460 | if (intVal == _nodeId) { |
| 7461 | driverElement->RemoveChild(nodeElement); |
| 7462 | break; |
| 7463 | } |
| 7464 | } |
| 7465 | } |
| 7466 | } |
| 7467 | nodeElement = nodeElement->NextSibling(); |
| 7468 | } |
| 7469 | } |
| 7470 | doc.SaveFile(filename.c_str()); |
| 7471 | LG.Unlock(); |
| 7472 | |
| 7473 | InitNode(_nodeId); |
| 7474 | } |
| 7475 | |
| 7476 | |
| 7477 |
no test coverage detected