| 813 | } |
| 814 | |
| 815 | void |
| 816 | WriteDataContainer::data_dropped(const DataSampleElement* sample, |
| 817 | bool dropped_by_transport) |
| 818 | { |
| 819 | DBG_ENTRY_LVL("WriteDataContainer","data_dropped",6); |
| 820 | |
| 821 | if (DCPS_debug_level >= 2) { |
| 822 | ACE_DEBUG ((LM_DEBUG, ACE_TEXT("(%P|%t) WriteDataContainer::data_dropped") |
| 823 | ACE_TEXT(" sample %X dropped_by_transport %d\n"), |
| 824 | sample, dropped_by_transport)); |
| 825 | } |
| 826 | |
| 827 | // If the transport initiates the data dropping, we need do same thing |
| 828 | // as data_delivered. e.g. remove the sample from the internal list |
| 829 | // and the instance list. We do not need acquire the lock here since |
| 830 | // the data_delivered acquires the lock. |
| 831 | if (dropped_by_transport) { |
| 832 | data_delivered(sample); |
| 833 | return; |
| 834 | } |
| 835 | |
| 836 | //The data_dropped could be called from the thread initiating sample remove |
| 837 | //which already hold the lock. In this case, it's not necessary to acquire |
| 838 | //lock here. It also could be called from the transport thread in a delayed |
| 839 | //notification, it's necessary to acquire lock here to protect the internal |
| 840 | //structures in this class. |
| 841 | |
| 842 | ACE_GUARD (ACE_Recursive_Thread_Mutex, |
| 843 | guard, |
| 844 | lock_); |
| 845 | |
| 846 | // The dropped sample should be in the sending_data_ list. |
| 847 | // Otherwise an exception will be raised. |
| 848 | // |
| 849 | // We are now been notified by transport, so we can |
| 850 | // keep the sample from the sending_data_ list still in |
| 851 | // sample list since we will send it. |
| 852 | |
| 853 | DataSampleElement* stale = const_cast<DataSampleElement*>(sample); |
| 854 | |
| 855 | // If sample is on a SendStateDataSampleList it should be on the |
| 856 | // sending_data_ list signifying it was given to the transport to |
| 857 | // deliver and now the transport is signaling it has been dropped |
| 858 | |
| 859 | if (sending_data_.dequeue(sample)) { |
| 860 | // else: The data_dropped is called as a result of remove_sample() |
| 861 | // called from reenqueue_all() which supports the TRANSIENT_LOCAL |
| 862 | // qos. The samples that are sending by transport are dropped from |
| 863 | // transport and will be moved to the unsent list for resend. |
| 864 | if (!shutdown_ && InstanceDataSampleList::on_some_list(sample)) { |
| 865 | unsent_data_.enqueue_tail(sample); |
| 866 | } else { |
| 867 | SendStateDataSampleList::remove(stale); |
| 868 | release_buffer(stale); |
| 869 | stale = 0; |
| 870 | } |
| 871 | |
| 872 | } else { |
nothing calls this directly
no test coverage detected