| 1341 | } |
| 1342 | |
| 1343 | void |
| 1344 | DataReaderImpl::data_received(const ReceivedDataSample& sample) |
| 1345 | { |
| 1346 | DBG_ENTRY_LVL("DataReaderImpl","data_received",6); |
| 1347 | |
| 1348 | DDS::InstanceHandle_t publication_handle = DDS::HANDLE_NIL; |
| 1349 | { |
| 1350 | ACE_GUARD(ACE_Recursive_Thread_Mutex, guard, publication_handle_lock_); |
| 1351 | RepoIdToHandleMap::const_iterator pos = publication_id_to_handle_map_.find(sample.header_.publication_id_); |
| 1352 | if (pos != publication_id_to_handle_map_.end()) { |
| 1353 | publication_handle = pos->second; |
| 1354 | } |
| 1355 | } |
| 1356 | |
| 1357 | // ensure some other thread is not changing the sample container |
| 1358 | // or statuses related to samples. |
| 1359 | ACE_GUARD(ACE_Recursive_Thread_Mutex, guard, this->sample_lock_); |
| 1360 | |
| 1361 | if (get_deleted()) return; |
| 1362 | |
| 1363 | if (DCPS_debug_level > 9) { |
| 1364 | ACE_DEBUG((LM_DEBUG, |
| 1365 | ACE_TEXT("(%P|%t) DataReaderImpl::data_received: ") |
| 1366 | ACE_TEXT("%C received sample: %C.\n"), |
| 1367 | LogGuid(get_guid()).c_str(), |
| 1368 | to_string(sample.header_).c_str())); |
| 1369 | } |
| 1370 | |
| 1371 | switch (sample.header_.message_id_) { |
| 1372 | case SAMPLE_DATA: |
| 1373 | case INSTANCE_REGISTRATION: { |
| 1374 | SubscriptionInstance_rch instance; |
| 1375 | if (!check_historic(sample)) break; |
| 1376 | |
| 1377 | DataSampleHeader const & header = sample.header_; |
| 1378 | |
| 1379 | this->writer_activity(header); |
| 1380 | |
| 1381 | // Verify data has not exceeded its lifespan. |
| 1382 | if (this->filter_sample(header)) break; |
| 1383 | |
| 1384 | // This adds the reader to the set/list of readers with data. |
| 1385 | RcHandle<SubscriberImpl> subscriber = get_subscriber_servant(); |
| 1386 | if (subscriber) { |
| 1387 | subscriber->data_received(this); |
| 1388 | } |
| 1389 | |
| 1390 | // Only gather statistics about real samples, not registration data, etc. |
| 1391 | if (header.message_id_ == SAMPLE_DATA) { |
| 1392 | this->process_latency(sample); |
| 1393 | } |
| 1394 | |
| 1395 | // This also adds to the sample container and makes any callbacks |
| 1396 | // and condition modifications. |
| 1397 | |
| 1398 | bool is_new_instance = false; |
| 1399 | bool filtered = false; |
| 1400 | dds_demarshal(sample, publication_handle, instance, is_new_instance, filtered, |
nothing calls this directly
no test coverage detected