fn handle_close_all_ports_for_sub(&mut self, sub_id: &String) -> Result<()> {
    self.sub_manager.clear_ports(Some(&sub_id));
    self.writelock_manager.unlock_all_ports_for_sub(sub_id);

    // Close ports with no subscribers
    let open_ports = self.port_manager.open_ports();
    let subscribed_ports = self.sub_manager.subscribed_ports();
    let ports_with_no_subs = open_ports.difference(&subscribed_ports);

    // For each open port that isn't subscribed,
    for port_to_close in ports_with_no_subs {
      // close it, REDUNDANT?
      self.port_manager.close_port(&port_to_close);
      // remove the write lock, REDUNDANT?
      self.writelock_manager.clear_lock(&port_to_close);
      // Let them know its closed
      let close_resp = SerialResponse::Closed {
        port: port_to_close.clone(),
      };
      self.send_message(&sub_id, close_resp);
    }
    Ok(())
  }
/// Handle closing all ports for sub
Handle closing all ports for sub
Handle closing all ports for sub
fn handle_close_all_ports_for_sub(&mut self, sub_id: &String) -> Result<()> {
    self.sub_manager.clear_ports(Some(&sub_id));
    self.writelock_manager.unlock_all_ports_for_sub(sub_id);
    // Close ports with no subscribers
    let open_ports = self.port_manager.open_ports();
    let subscribed_ports = self.sub_manager.subscribed_ports();
    let ports_with_no_subs = open_ports.difference(&subscribed_ports);
    // For each open port that isn't subscribed,
    for port_to_close in ports_with_no_subs {
      // close it, REDUNDANT?
      self.port_manager.close_port(&port_to_close);
      // remove the write lock, REDUNDANT?
      self.writelock_manager.clear_lock(&port_to_close);
      // Let them know its closed
      let close_resp = SerialResponse::Closed {
        port: port_to_close.clone(),
      };
      self.send_message(&sub_id, close_resp);
    }
    Ok(())
  }
fn handle_close_all_ports_for_sub ( & mut self , sub_id : & String ) -> Result < ( ) > { self . sub_manager . clear_ports ( Some ( & sub_id ) ) ; self . writelock_manager . unlock_all_ports_for_sub ( sub_id ) ; // Close ports with no subscribers let open_ports = self . port_manager . open_ports ( ) ; let subscribed_ports = self . sub_manager . subscribed_ports ( ) ; let ports_with_no_subs = open_ports . difference ( & subscribed_ports ) ; // For each open port that isn't subscribed, for port_to_close in ports_with_no_subs { // close it, REDUNDANT? self . port_manager . close_port ( & port_to_close ) ; // remove the write lock, REDUNDANT? self . writelock_manager . clear_lock ( & port_to_close ) ; // Let them know its closed let close_resp = SerialResponse :: Closed { port : port_to_close . clone ( ) , } ; self . send_message ( & sub_id , close_resp ) ; } Ok ( ( ) ) }
Handle closing all ports for sub
Handle closing all ports for sub
&mut self
sub_id
&String
&mut self
sub_id
&String