TEST_F(PacksTests, test_discovery_cache) { auto pack = Pack("foobar", getPackWithDiscovery()); for (int i = 0; i < 5; i++) { pack.checkDiscovery(); } auto stats = pack.getStats(); EXPECT_EQ(stats.total, 5); EXPECT_EQ(stats.hits, 4); EXPECT_EQ(stats.misses, 1); }
LIBFREESPACE_API int freespace_perform() { int rc; // Reset the perform event ResetEvent(freespace_instance_->performEvent_); // Check if the device discovery thread has detected any changes // and rescan if so. rc = checkDiscovery(); // Service all of the devices. // NOTE: Servicing includes initiating freespace_private_filterDevices(NULL, 0, NULL, performHelper); return rc; }
LIBFREESPACE_API int freespace_getDeviceList(FreespaceDeviceId* list, int listSize, int *listSizeOut) { int i; int rc; // Check if the device list has changed. rc = checkDiscovery(); if (rc != FREESPACE_SUCCESS) { return rc; } for (*listSizeOut = 0, i = 0; *listSizeOut < listSize && i < freespace_instance_->deviceCount_; i++) { struct FreespaceDeviceStruct* device = freespace_instance_->devices_[i]; if (device->isAvailable_) { list[*listSizeOut] = device->id_; (*listSizeOut)++; } } return FREESPACE_SUCCESS; }
bool Pack::shouldPackExecute() { return checkVersion() && checkPlatform() && checkDiscovery(); }
bool Pack::shouldPackExecute() { return (valid_ && checkDiscovery()); }
bool Pack::shouldPackExecute() { active_ = (valid_ && checkDiscovery()); return active_; }
bool Pack::shouldPackExecute() { return checkDiscovery(); }