BOOL CNetMgr::RemoveUpdateNotification(const GUID *pguidNode, const GUID *pguidClass, DWORD dwCmd) {_STT(); // Sanity checks if ( pguidNode == NULL || pguidClass == NULL ) return FALSE; // Acquire lock CTlLocalLock ll( *this ); if ( !ll.IsLocked() ) return FALSE; // Get a list of nodes for the specified class THList< DWORD, THList< GUID, CTimeout > > *pCmds = m_lstUpdates.get( *pguidClass ); if ( pCmds == NULL ) return FALSE; // Get the list of nodes wanting updates on this command THList< GUID, CTimeout > *pNodes = pCmds->get( dwCmd ); if ( pNodes == NULL ) return FALSE; // Erase this node pNodes->erase( *pguidNode ); // Cleanup invalid nodes as we go... if ( !pNodes->Size() ) { pCmds->erase( dwCmd ); if ( !pCmds->Size() ) m_lstUpdates.erase( *pguidClass ); } // end if return TRUE; }
BOOL CNetMgr::NotifyNetwork(const GUID *pguidClass, DWORD dwCmd) {_STT(); // Sanity checks if ( pguidClass == NULL ) return FALSE; // Acquire lock CTlLocalLock ll( *this ); if ( !ll.IsLocked() ) return FALSE; //wjr 9/22/06... // "Special" case just between MainLoop & NetMgr. if( pguidClass && IsEqualGUID( *pguidClass, NetCmd::IID ) && NetCmd::efDoCleanup == dwCmd ) { Cleanup(); return TRUE; } //...wjr 9/22/06 // Get a list of nodes for the specified class THList< DWORD, THList< GUID, CTimeout > > *pCmds = m_lstUpdates.get( *pguidClass ); if ( pCmds == NULL ) return FALSE; // Get the list of nodes wanting updates on this command THList< GUID, CTimeout > *pNodes = pCmds->get( dwCmd ); if ( pNodes == NULL ) return FALSE; BOOL bErased = FALSE; THList< GUID, CTimeout >::iterator it = NULL; while ( ( it = pNodes->next( it ) ) != NULL ) // Attempt to send the message if ( !Msg( it->key(), pguidClass, dwCmd | CNetMsg::fUpdate ) ) { bErased = TRUE; it = pNodes->erase( it ); } // Cleanup invalid nodes as we go... if ( bErased && !pNodes->Size() ) { pCmds->erase( dwCmd ); if ( !pCmds->Size() ) m_lstUpdates.erase( *pguidClass ); } // end if return TRUE; }
BOOL CNetMgr::AddUpdateNotification(const GUID *pguidNode, const GUID *pguidClass, DWORD dwCmd) {_STT(); // Sanity checks if ( pguidNode == NULL || pguidClass == NULL ) return FALSE; // Acquire lock CTlLocalLock ll( *this ); if ( !ll.IsLocked() ) return FALSE; // Get a list of nodes for the specified class THList< DWORD, THList< GUID, CTimeout > > *pCmds = m_lstUpdates.get( *pguidClass ); if ( pCmds == NULL ) return FALSE; // Get the list of nodes wanting updates on this command THList< GUID, CTimeout > *pNodes = pCmds->get( dwCmd ); if ( pNodes == NULL ) return FALSE; // Add if not in the list already if ( (*pNodes)[ *pguidNode ] == NULL ) pNodes->push_back( *pguidNode ); return TRUE; }