| 172 | |
| 173 | |
| 174 | void RecorderImpl::data_received(const ReceivedDataSample& sample) |
| 175 | { |
| 176 | DBG_ENTRY_LVL("RecorderImpl","data_received",6); |
| 177 | |
| 178 | // Ensure some other thread is not changing the sample container |
| 179 | // or statuses related to samples. |
| 180 | ACE_GUARD(ACE_Recursive_Thread_Mutex, guard, sample_lock_); |
| 181 | |
| 182 | if (DCPS_debug_level >= 8) { |
| 183 | ACE_DEBUG((LM_DEBUG, |
| 184 | "(%P|%t) RecorderImpl::data_received: " |
| 185 | "%C received sample: %C\n", |
| 186 | LogGuid(subscription_id_).c_str(), |
| 187 | to_string(sample.header_).c_str())); |
| 188 | } |
| 189 | |
| 190 | // we only support SAMPLE_DATA messages |
| 191 | if (sample.header_.message_id_ == SAMPLE_DATA && listener_.in()) { |
| 192 | Message_Block_Ptr payload(sample.data(&mb_alloc_)); |
| 193 | Encoding::Kind kind = Encoding::KIND_UNALIGNED_CDR; |
| 194 | if (sample.header_.cdr_encapsulation_ && check_encap_) { |
| 195 | Encoding enc; |
| 196 | Serializer ser(payload.get(), enc); |
| 197 | EncapsulationHeader encap; |
| 198 | if (ser >> encap && to_any_encoding(enc, encap)) { |
| 199 | kind = enc.kind(); |
| 200 | } |
| 201 | } |
| 202 | RawDataSample rawSample(sample.header_, |
| 203 | static_cast<MessageId> (sample.header_.message_id_), |
| 204 | sample.header_.source_timestamp_sec_, |
| 205 | sample.header_.source_timestamp_nanosec_, |
| 206 | sample.header_.publication_id_, |
| 207 | sample.header_.byte_order_, |
| 208 | payload.get(), |
| 209 | kind); |
| 210 | listener_->on_sample_data_received(this, rawSample); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | void RecorderImpl::notify_subscription_disconnected(const WriterIdSeq&) |
| 215 | { |
nothing calls this directly
no test coverage detected