pub(crate) fn new(
    domain_info: DomainInfo,
    udp_listeners: HashMap<Token, UDPListener>,
    ddscache: Arc<RwLock<DDSCache>>,
    discovery_db: Arc<RwLock<DiscoveryDB>>,
    participant_guid_prefix: GuidPrefix,
    add_reader_receiver: TokenReceiverPair<Reader>,
    remove_reader_receiver: TokenReceiverPair<GUID>,
    add_writer_receiver: TokenReceiverPair<Writer>,
    remove_writer_receiver: TokenReceiverPair<GUID>,
    stop_poll_receiver: mio_channel::Receiver<()>,
    discovery_update_notification_receiver: mio_channel::Receiver<DiscoveryNotificationType>,
  ) -> DPEventLoop {
    let poll = Poll::new().expect("Unable to create new poll.");
    let (acknack_sender, acknack_reciever) =
      mio_channel::sync_channel::<(GuidPrefix, AckNack)>(100);
    let mut udp_listeners = udp_listeners;
    for (token, listener) in &mut udp_listeners {
      poll
        .register(
          listener.mio_socket(),
          token.clone(),
          Ready::readable(),
          PollOpt::edge(),
        )
        .expect("Failed to register listener.");
    }

    poll
      .register(
        &add_reader_receiver.receiver,
        add_reader_receiver.token.clone(),
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register reader adder.");

    poll
      .register(
        &remove_reader_receiver.receiver,
        remove_reader_receiver.token.clone(),
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register reader remover.");
    poll
      .register(
        &add_writer_receiver.receiver,
        add_writer_receiver.token,
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register add writer channel");

    poll
      .register(
        &remove_writer_receiver.receiver,
        remove_writer_receiver.token,
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register remove writer channel");

    poll
      .register(
        &stop_poll_receiver,
        STOP_POLL_TOKEN,
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register stop poll channel");

    poll
      .register(
        &acknack_reciever,
        ACKNACK_MESSGAGE_TO_LOCAL_WRITER_TOKEN,
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register AckNack submessage sending from MessageReciever to DPEventLoop");

    poll
      .register(
        &discovery_update_notification_receiver,
        DISCOVERY_UPDATE_NOTIFICATION_TOKEN,
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register reader update notification.");

    DPEventLoop {
      domain_info,
      poll,
      ddscache,
      discovery_db,
      udp_listeners,
      message_receiver: MessageReceiver::new(participant_guid_prefix, acknack_sender),
      add_reader_receiver,
      remove_reader_receiver,
      reader_timed_event_receiver: HashMap::new(),
      reader_command_receiver_identification: HashMap::new(),
      add_writer_receiver,
      remove_writer_receiver,
      writer_timed_event_reciever: HashMap::new(),
      stop_poll_receiver,
      writers: HashMap::new(),
      ack_nack_reciever: acknack_reciever,
      discovery_update_notification_receiver,
    }
  }
// This pub(crate) , because it should be constructed only by DomainParticipant.
This pub(crate) , because it should be constructed only by DomainParticipant.
This pub ( crate ) because it should be constructed only by DomainParticipant .
pub(crate) fn new(
    domain_info: DomainInfo,
    udp_listeners: HashMap<Token, UDPListener>,
    ddscache: Arc<RwLock<DDSCache>>,
    discovery_db: Arc<RwLock<DiscoveryDB>>,
    participant_guid_prefix: GuidPrefix,
    add_reader_receiver: TokenReceiverPair<Reader>,
    remove_reader_receiver: TokenReceiverPair<GUID>,
    add_writer_receiver: TokenReceiverPair<Writer>,
    remove_writer_receiver: TokenReceiverPair<GUID>,
    stop_poll_receiver: mio_channel::Receiver<()>,
    discovery_update_notification_receiver: mio_channel::Receiver<DiscoveryNotificationType>,
  ) -> DPEventLoop {
    let poll = Poll::new().expect("Unable to create new poll.");
    let (acknack_sender, acknack_reciever) =
      mio_channel::sync_channel::<(GuidPrefix, AckNack)>(100);
    let mut udp_listeners = udp_listeners;
    for (token, listener) in &mut udp_listeners {
      poll
        .register(
          listener.mio_socket(),
          token.clone(),
          Ready::readable(),
          PollOpt::edge(),
        )
        .expect("Failed to register listener.");
    }
    poll
      .register(
        &add_reader_receiver.receiver,
        add_reader_receiver.token.clone(),
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register reader adder.");
    poll
      .register(
        &remove_reader_receiver.receiver,
        remove_reader_receiver.token.clone(),
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register reader remover.");
    poll
      .register(
        &add_writer_receiver.receiver,
        add_writer_receiver.token,
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register add writer channel");
    poll
      .register(
        &remove_writer_receiver.receiver,
        remove_writer_receiver.token,
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register remove writer channel");
    poll
      .register(
        &stop_poll_receiver,
        STOP_POLL_TOKEN,
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register stop poll channel");
    poll
      .register(
        &acknack_reciever,
        ACKNACK_MESSGAGE_TO_LOCAL_WRITER_TOKEN,
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register AckNack submessage sending from MessageReciever to DPEventLoop");
    poll
      .register(
        &discovery_update_notification_receiver,
        DISCOVERY_UPDATE_NOTIFICATION_TOKEN,
        Ready::readable(),
        PollOpt::edge(),
      )
      .expect("Failed to register reader update notification.");
    DPEventLoop {
      domain_info,
      poll,
      ddscache,
      discovery_db,
      udp_listeners,
      message_receiver: MessageReceiver::new(participant_guid_prefix, acknack_sender),
      add_reader_receiver,
      remove_reader_receiver,
      reader_timed_event_receiver: HashMap::new(),
      reader_command_receiver_identification: HashMap::new(),
      add_writer_receiver,
      remove_writer_receiver,
      writer_timed_event_reciever: HashMap::new(),
      stop_poll_receiver,
      writers: HashMap::new(),
      ack_nack_reciever: acknack_reciever,
      discovery_update_notification_receiver,
    }
  }
pub ( crate ) fn new ( domain_info : DomainInfo , udp_listeners : HashMap < Token , UDPListener > , ddscache : Arc < RwLock < DDSCache > > , discovery_db : Arc < RwLock < DiscoveryDB > > , participant_guid_prefix : GuidPrefix , add_reader_receiver : TokenReceiverPair < Reader > , remove_reader_receiver : TokenReceiverPair < GUID > , add_writer_receiver : TokenReceiverPair < Writer > , remove_writer_receiver : TokenReceiverPair < GUID > , stop_poll_receiver : mio_channel :: Receiver < ( ) > , discovery_update_notification_receiver : mio_channel :: Receiver < DiscoveryNotificationType > , ) -> DPEventLoop { let poll = Poll :: new ( ) . expect ( " " ) ; let ( acknack_sender , acknack_reciever ) = mio_channel :: sync_channel :: < ( GuidPrefix , AckNack ) > ( 100 ) ; let mut udp_listeners = udp_listeners ; for ( token , listener ) in & mut udp_listeners { poll . register ( listener . mio_socket ( ) , token . clone ( ) , Ready :: readable ( ) , PollOpt :: edge ( ) , ) . expect ( " " ) ; } poll . register ( & add_reader_receiver . receiver , add_reader_receiver . token . clone ( ) , Ready :: readable ( ) , PollOpt :: edge ( ) , ) . expect ( " " ) ; poll . register ( & remove_reader_receiver . receiver , remove_reader_receiver . token . clone ( ) , Ready :: readable ( ) , PollOpt :: edge ( ) , ) . expect ( " " ) ; poll . register ( & add_writer_receiver . receiver , add_writer_receiver . token , Ready :: readable ( ) , PollOpt :: edge ( ) , ) . expect ( " " ) ; poll . register ( & remove_writer_receiver . receiver , remove_writer_receiver . token , Ready :: readable ( ) , PollOpt :: edge ( ) , ) . expect ( " " ) ; poll . register ( & stop_poll_receiver , STOP_POLL_TOKEN , Ready :: readable ( ) , PollOpt :: edge ( ) , ) . expect ( " " ) ; poll . register ( & acknack_reciever , ACKNACK_MESSGAGE_TO_LOCAL_WRITER_TOKEN , Ready :: readable ( ) , PollOpt :: edge ( ) , ) . expect ( " " ) ; poll . register ( & discovery_update_notification_receiver , DISCOVERY_UPDATE_NOTIFICATION_TOKEN , Ready :: readable ( ) , PollOpt :: edge ( ) , ) . expect ( " " ) ; DPEventLoop { domain_info , poll , ddscache , discovery_db , udp_listeners , message_receiver : MessageReceiver :: new ( participant_guid_prefix , acknack_sender ) , add_reader_receiver , remove_reader_receiver , reader_timed_event_receiver : HashMap :: new ( ) , reader_command_receiver_identification : HashMap :: new ( ) , add_writer_receiver , remove_writer_receiver , writer_timed_event_reciever : HashMap :: new ( ) , stop_poll_receiver , writers : HashMap :: new ( ) , ack_nack_reciever : acknack_reciever , discovery_update_notification_receiver , } }
This pub(crate) , because it should be constructed only by DomainParticipant.
This pub ( crate ) because it should be constructed only by DomainParticipant .
domain_info
DomainInfo
udp_listeners
HashMap<Token, UDPListener>
ddscache
Arc<RwLock<DDSCache>>
discovery_db
Arc<RwLock<DiscoveryDB>>
participant_guid_prefix
GuidPrefix
add_reader_receiver
TokenReceiverPair<Reader>
remove_reader_receiver
TokenReceiverPair<GUID>
add_writer_receiver
TokenReceiverPair<Writer>
remove_writer_receiver
TokenReceiverPair<GUID>
stop_poll_receiver
mio_channel::Receiver<()>
discovery_update_notification_receiver
mio_channel::Receiver<DiscoveryNotificationType>