mirror of
https://github.com/ElvishArtisan/rivendell.git
synced 2025-10-11 09:03:40 +02:00
2020-02-18 Fred Gleason <fredg@paravelsystems.com>
* Fixed a regression in the implmenetation of the 'Set Serial Trap' ['SI'] RML that could cause deadlocks and intermittent operation.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Local RML Macros for the Rivendell Interprocess Communication Daemon
|
||||
//
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -96,19 +96,22 @@ void MainObject::gpoStateData(int matrix,unsigned line,bool state)
|
||||
|
||||
void MainObject::ttyTrapData(int cartnum)
|
||||
{
|
||||
rda->syslog(LOG_DEBUG,"executing trap cart %06d",cartnum);
|
||||
ExecCart(cartnum);
|
||||
}
|
||||
|
||||
|
||||
void MainObject::ttyScanData()
|
||||
|
||||
void MainObject::ttyReadyReadData(int num)
|
||||
{
|
||||
char buf[256];
|
||||
int n;
|
||||
|
||||
for(int i=0;i<MAX_TTYS;i++) {
|
||||
if(ripcd_tty_dev[i]!=NULL) {
|
||||
while((n=ripcd_tty_dev[i]->read(buf,255))>0) {
|
||||
ripcd_tty_trap[i]->scan(buf,n);
|
||||
if(ripcd_tty_dev[num]!=NULL) {
|
||||
while((n=ripcd_tty_dev[num]->read(buf,255))>0) {
|
||||
buf[n]=0;
|
||||
if(ripcd_tty_trap[num]!=NULL) {
|
||||
ripcd_tty_trap[num]->scan(buf,n);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,6 +209,10 @@ void MainObject::LoadLocalMacros()
|
||||
ripcd_tty_dev[tty_port]->
|
||||
setParity((RDTTYDevice::Parity)q->value(4).toInt());
|
||||
if(ripcd_tty_dev[tty_port]->open(QIODevice::ReadWrite)) {
|
||||
connect(ripcd_tty_dev[tty_port],SIGNAL(readyRead()),
|
||||
ripcd_tty_ready_read_mapper,SLOT(map()));
|
||||
ripcd_tty_ready_read_mapper->
|
||||
setMapping(ripcd_tty_dev[tty_port],tty_port);
|
||||
ripcd_tty_term[tty_port]=(RDTty::Termination)q->value(5).toInt();
|
||||
ripcd_tty_inuse[tty_port]=true;
|
||||
ripcd_tty_trap[tty_port]=new RDCodeTrap(this);
|
||||
@@ -219,9 +226,6 @@ void MainObject::LoadLocalMacros()
|
||||
}
|
||||
}
|
||||
delete q;
|
||||
QTimer *timer=new QTimer(this,"tty_scan_timer");
|
||||
connect(timer,SIGNAL(timeout()),this,SLOT(ttyScanData()));
|
||||
timer->start(RIPCD_TTY_READ_INTERVAL);
|
||||
}
|
||||
|
||||
|
||||
@@ -631,7 +635,7 @@ void MainObject::RunLocalMacros(RDMacro *rml_in)
|
||||
sendRml(rml);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case RDMacro::SI:
|
||||
tty_port=rml->arg(0).toInt();
|
||||
if((tty_port<0)||(tty_port>MAX_TTYS)||(rml->argQuantity()!=3)) {
|
||||
@@ -652,6 +656,8 @@ void MainObject::RunLocalMacros(RDMacro *rml_in)
|
||||
str+=rml->arg(rml->argQuantity()-1);
|
||||
ripcd_tty_trap[tty_port]->addTrap(rml->arg(1).toInt(),
|
||||
str,str.length());
|
||||
rda->syslog(LOG_DEBUG,"added trap \"%s\" to tty port %d",
|
||||
(const char *)str.toUtf8(),rml->arg(1).toInt());
|
||||
rml->acknowledge(true);
|
||||
sendRml(rml);
|
||||
return;
|
||||
@@ -793,6 +799,7 @@ void MainObject::RunLocalMacros(RDMacro *rml_in)
|
||||
//
|
||||
if(ripcd_tty_dev[tty_port]!=NULL) {
|
||||
ripcd_tty_dev[tty_port]->close();
|
||||
ripcd_tty_ready_read_mapper->disconnect(ripcd_tty_dev[tty_port]);
|
||||
delete ripcd_tty_dev[tty_port];
|
||||
ripcd_tty_dev[tty_port]=NULL;
|
||||
ripcd_tty_inuse[tty_port]=false;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Rivendell Interprocess Communication Daemon
|
||||
//
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -125,6 +125,13 @@ MainObject::MainObject(QObject *parent)
|
||||
connect(ripc_macro_timer[i],SIGNAL(timeout()),mapper,SLOT(map()));
|
||||
}
|
||||
|
||||
//
|
||||
// TTY Ready Read Mapper
|
||||
//
|
||||
ripcd_tty_ready_read_mapper=new QSignalMapper(this);
|
||||
connect(ripcd_tty_ready_read_mapper,SIGNAL(mapped(int)),
|
||||
this,SLOT(ttyReadyReadData(int)));
|
||||
|
||||
ripcd_host_addr=rda->station()->address();
|
||||
|
||||
//
|
||||
|
@@ -2,7 +2,7 @@
|
||||
//
|
||||
// Rivendell Interprocess Communication Daemon
|
||||
//
|
||||
// (C) Copyright 2002-2019 Fred Gleason <fredg@paravelsystems.com>
|
||||
// (C) Copyright 2002-2020 Fred Gleason <fredg@paravelsystems.com>
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License version 2 as
|
||||
@@ -55,7 +55,6 @@
|
||||
//
|
||||
#define RIPCD_MAX_LENGTH 256
|
||||
#define RIPCD_RML_READ_INTERVAL 100
|
||||
#define RIPCD_TTY_READ_INTERVAL 100
|
||||
#define RIPCD_USAGE "[-d]\n\nSupplying the '-d' flag will set 'debug' mode, causing ripcd(8) to stay\nin the foreground and print debugging info on standard output.\n"
|
||||
|
||||
class MainObject : public QObject
|
||||
@@ -77,7 +76,7 @@ class MainObject : public QObject
|
||||
void gpiStateData(int matrix,unsigned line,bool state);
|
||||
void gpoStateData(int matrix,unsigned line,bool state);
|
||||
void ttyTrapData(int cartnum);
|
||||
void ttyScanData();
|
||||
void ttyReadyReadData(int num);
|
||||
void macroTimerData(int num);
|
||||
void readyReadData(int conn_id);
|
||||
void killData(int conn_id);
|
||||
@@ -130,6 +129,7 @@ class MainObject : public QObject
|
||||
bool ripcd_tty_inuse[MAX_TTYS];
|
||||
int ripcd_switcher_tty[MAX_MATRICES][2];
|
||||
RDTTYDevice *ripcd_tty_dev[MAX_TTYS];
|
||||
QSignalMapper *ripcd_tty_ready_read_mapper;
|
||||
RDTty::Termination ripcd_tty_term[MAX_TTYS];
|
||||
RDCodeTrap *ripcd_tty_trap[MAX_TTYS];
|
||||
bool ripc_onair_flag;
|
||||
|
Reference in New Issue
Block a user