Exemple #1
0
static void
ng_DescriptorRead(struct fdescriptor *d, struct bundle *bundle,
                  const fd_set *fdset)
{
    struct physical *p = descriptor2physical(d);
    struct ngdevice *dev = device2ng(p->handler);

    if (dev->cs >= 0 && FD_ISSET(dev->cs, fdset))
        ng_MessageIn(p, NULL, 0);

    if (physical_IsSet(d, fdset))
        physical_DescriptorRead(d, bundle, fdset);
}
Exemple #2
0
static void
ether_DescriptorRead(struct fdescriptor *d, struct bundle *bundle,
                     const fd_set *fdset)
{
  struct physical *p = descriptor2physical(d);
  struct etherdevice *dev = device2ether(p->handler);

  if (dev->cs >= 0 && FD_ISSET(dev->cs, fdset)) {
    ether_MessageIn(dev);
    if (dev->connected == CARRIER_LOST) {
      log_Printf(LogPHASE, "%s: Device disconnected\n", p->link.name);
      datalink_Down(p->dl, CLOSE_NORMAL);
      return;
    }
  }

  if (physical_IsSet(d, fdset))
    physical_DescriptorRead(d, bundle, fdset);
}