コード例 #1
0
ファイル: io.c プロジェクト: ggrossman/telechat-ng
void transmit (SLOT *sp)
{
  if (sp->flags.die)
    return;

  if (writequeue (sp, &sp->outq) < 0) {
    if (sp->acct.chan < NUMCHANNELS) {
      remove_from_channel (sp, sp->acct.chan); 
      remove_from_channel (sp, MAINLIST); 
    }
    if (sp->acct.chan && sp->flags.on) {
      paabout (sp, DISCONNECTED);
      sp->acct.last_logout = time (NULL);
    }
    inactivate_slot (sp, 0);
    return;
  }

  if (!qempty (&sp->stopq) && !sp->flags.stopped &&
      writequeue (sp, &sp->stopq) < 0) {
    if (sp->acct.chan < NUMCHANNELS) {
      remove_from_channel (sp, sp->acct.chan); 
      remove_from_channel (sp, MAINLIST); 
    }
    if (sp->acct.chan && sp->flags.on) {
      paabout (sp, DISCONNECTED);
      sp->acct.last_logout = time (NULL);
    }
    inactivate_slot (sp, 0);
  }
}
コード例 #2
0
void processqueue(){

    // Writes queue files to slaves, and checks if the addresses are linked.
    // If so, it also writes the value to the linked address.

    qWarning()<< "Processing Queue";

    uint i; uint y;
    for (i = queuecounter;i > 0; i--)
    {    
        qWarning()<< GUIqueuefile[i].addresstype;
        qWarning()<< GUIqueuefile[i].slavetype;
    writequeue(GUIqueuefile[i].slavetype, GUIqueuefile[i].slavename, GUIqueuefile[i].addresstype, GUIqueuefile[i].address,GUIqueuefile[i].value);
        for (y = 0; y <=linkedlength; y++)
        {

         if (GUIqueuefile[i].slavetype == LCD_CONTROL)
            {
           //  qWarning()<<"Checking for link in LCD CONTROL";
              if ((GUIqueuefile[i].addresstype == Linked_DB[y].LCD_register.addresstype) && (GUIqueuefile[i].address == Linked_DB[y].LCD_register.address))
                {
             //    qWarning() << "Link in LCD Control found!";
                 writequeue(Linked_DB[y].nonLCD_register.slavetype, Linked_DB[y].nonLCD_register.slavename,
                            Linked_DB[y].nonLCD_register.addresstype, Linked_DB[y].nonLCD_register.address, GUIqueuefile[i].value);
                }
          }else{
           // qWarning()<< "Checking for link in nonLCD CONTROL";

            if ((GUIqueuefile[i].addresstype == Linked_DB[y].nonLCD_register.addresstype) && (GUIqueuefile[i].address == Linked_DB[y].nonLCD_register.address))
                {
             //    qWarning() << "Link in NONLCD Control found!";
                 writequeue(Linked_DB[y].LCD_register.slavetype, Linked_DB[y].LCD_register.slavename,
                            Linked_DB[y].LCD_register.addresstype, Linked_DB[y].LCD_register.address, GUIqueuefile[i].value);
                 }
            }
        }

    }
    deletequeuedata();
}