MulticastSession* MulticastTransport::start_session(const MulticastDataLink_rch& link, MulticastPeer remote_peer, bool active) { if (link.is_nil()) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ") ACE_TEXT("MulticastTransport[%C]::start_session: ") ACE_TEXT("link is nil\n"), this->config_i_->name().c_str()), 0); } MulticastSession_rch session = link->find_or_create_session(remote_peer); if (session.is_nil()) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ") ACE_TEXT("MulticastTransport[%C]::start_session: ") ACE_TEXT("failed to create session for remote peer: 0x%x!\n"), this->config_i_->name().c_str(), remote_peer), 0); } if (!session->start(active)) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ") ACE_TEXT("MulticastTransport[%C]::start_session: ") ACE_TEXT("failed to start session for remote peer: 0x%x!\n"), this->config_i_->name().c_str(), remote_peer), 0); } return session._retn(); }
DataLink* MulticastTransport::find_datalink_i(const RepoId& /*local_id*/, const RepoId& remote_id, const TransportBLOB& /*remote_data*/, CORBA::Long /*priority*/, bool active) { // To accommodate the one-to-many nature of multicast reservations, // a session layer is used to maintain state between unique pairs // of DomainParticipants over a single DataLink instance. Given // that TransportImpl instances may only be attached to either // Subscribers or Publishers within the same DomainParticipant, // it may be assumed that the local_id always references the same // participant. MulticastDataLink_rch link; if (active && !this->client_link_.is_nil()) { link = this->client_link_; } if (!active && !this->server_link_.is_nil()) { link = this->server_link_; } if (!link.is_nil()) { MulticastPeer remote_peer = RepoIdConverter(remote_id).participantId(); MulticastSession_rch session = link->find_session(remote_peer); if (session.is_nil()) { // From the framework's point-of-view, no DataLink was found. // This way we will progress to the connect/accept stage for handshaking. return 0; } if (!session->start(active)) { ACE_ERROR_RETURN((LM_ERROR, ACE_TEXT("(%P|%t) ERROR: ") ACE_TEXT("MulticastTransport[%C]::find_datalink_i: ") ACE_TEXT("failed to start session for remote peer: 0x%x!\n"), this->config_i_->name().c_str(), remote_peer), 0); } VDBG_LVL((LM_DEBUG, "(%P|%t) MulticastTransport[%C]::find_datalink_i " "started session for remote peer: 0x%x\n", this->config_i_->name().c_str(), remote_peer), 2); } return link._retn(); }