| 560 | } |
| 561 | |
| 562 | void |
| 563 | DataWriterImpl::remove_associations(const ReaderIdSeq & readers, |
| 564 | CORBA::Boolean notify_lost) |
| 565 | { |
| 566 | if (readers.length() == 0) { |
| 567 | return; |
| 568 | } |
| 569 | |
| 570 | const Observer_rch observer = get_observer(Observer::e_DISASSOCIATED); |
| 571 | if (observer) { |
| 572 | for (CORBA::ULong i = 0; i < readers.length(); ++i) { |
| 573 | observer->on_disassociated(this, readers[i]); |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | if (DCPS_debug_level >= 1) { |
| 578 | ACE_DEBUG((LM_DEBUG, |
| 579 | ACE_TEXT("(%P|%t) DataWriterImpl::remove_associations: ") |
| 580 | ACE_TEXT("bit %d local %C remote %C num remotes %d\n"), |
| 581 | is_bit_, |
| 582 | LogGuid(publication_id_).c_str(), |
| 583 | LogGuid(readers[0]).c_str(), |
| 584 | readers.length())); |
| 585 | } |
| 586 | |
| 587 | // stop pending associations for these reader ids |
| 588 | this->stop_associating(readers.get_buffer(), readers.length()); |
| 589 | |
| 590 | ReaderIdSeq fully_associated_readers; |
| 591 | CORBA::ULong fully_associated_len = 0; |
| 592 | ReaderIdSeq rds; |
| 593 | CORBA::ULong rds_len = 0; |
| 594 | DDS::InstanceHandleSeq handles; |
| 595 | |
| 596 | ACE_GUARD(ACE_Thread_Mutex, wait_guard, sync_unreg_rem_assocs_lock_); |
| 597 | { |
| 598 | // Ensure the same acquisition order as in wait_for_acknowledgments(). |
| 599 | ACE_GUARD(ACE_Recursive_Thread_Mutex, guard, this->lock_); |
| 600 | //Remove the readers from fully associated reader list. |
| 601 | //If the supplied reader is not in the cached reader list then it is |
| 602 | //already removed. We just need remove the readers in the list that have |
| 603 | //not been removed. |
| 604 | |
| 605 | CORBA::ULong len = readers.length(); |
| 606 | |
| 607 | for (CORBA::ULong i = 0; i < len; ++i) { |
| 608 | //Remove the readers from fully associated reader list. If it's not |
| 609 | //in there, the association_complete() is not called yet and remove it |
| 610 | //from pending list. |
| 611 | |
| 612 | if (remove(readers_, readers[i]) == 0) { |
| 613 | ++ fully_associated_len; |
| 614 | fully_associated_readers.length(fully_associated_len); |
| 615 | fully_associated_readers [fully_associated_len - 1] = readers[i]; |
| 616 | |
| 617 | ++ rds_len; |
| 618 | rds.length(rds_len); |
| 619 | rds [rds_len - 1] = readers[i]; |
no test coverage detected