• 3 Posts
  • 395 Comments
Joined 1 year ago
cake
Cake day: June 12th, 2023

help-circle

  • The bingo one actually uses crossbeam channels instead of mutexes, so that’s nice. I haven’t looked too closely at it though.

    I don’t think you can do too much about the Spectrum one if you want to keep the two threads, but here’s what I would change related to thread synchronization. Lemmy doesn’t seem to allow me to attach patch files for whatever reason so have an archive instead… https://dblsaiko.net/pub/tmp/patches.tar.bz2 (I wrote a few notes in the commit messages)

    Just to give the reason for Rc<RefCell> in the current project. I’m reading in a M3U file and I’m going to be referencing it against an Excel file. So in the structure for the m3u file, I have two BtreeMaps, one for order by channel number and one by name. Each containing references to the same Channel object.

    So basically it’s channels indexed by channel number and name? That one is actually one of the easy cases. Store indices instead:

    struct Channels {
      data: Vec<Channel>,
      by_number: BTreeMap<u32 /* or whatever */, usize>,
      by_name: BTreeMap<String, usize>,
    }
    
    // untested but I think it should compile
    fn get_channel_by_name(ch: &Channels, name: &str) -> Option<&Channel> {
      Some(&self.data[*ch.by_name.get(name)?])
    }
    










  • Not a professional networking guy either but here’s my opinion.

    What I would do is use the ISP router as is, open all ports on it (except to itself, hopefully it doesn’t do that…), and put a firewall in between the router and everything else that controls the actual access to everything behind it (in bridge mode between the two network interfaces of the firewall, so you only have the one network).

    Could a potential second router also assign addresses to devices in that globally routable space directly?

    Devices in IPv6 assign addresses themselves via SLAAC, you just need one device advertising the prefix which the ISP router should already do. The firewall should be able to just purely be there for packet filtering. If you need fixed addresses for public facing servers I would just assign them manually to the respective boxes as you likely also need to add them to public DNS manually anyway.