void cRunningScript::cleanupSend () { if (!sendInProgress) return; // if some text was being sent // we behave as if the text was delivered successfully, to avoid deadlocking sendInProgress = false; if (flowcontrol) emit textSent (); }
void MainWindow::joinServer() { clientWidget = new TcpClientWidget(ui->connection_widget); clientWidget->setVisible(true); clientWidget->setUserName(ui->nickName_lineEdit->text()); ui->connection_widget->layout()->addWidget(clientWidget); ui->stackedWidget->setCurrentIndex(1); connect(ui->chatWidget,SIGNAL(textSent(QString)),clientWidget,SLOT(sendTextMessage(QString))); connect(clientWidget,SIGNAL(textMessage(QString)),ui->chatWidget,SLOT(textReceived(QString))); //clientWidget->connectSocket(ui->host_ip_lineEdit->text(),ui->port_lineEdit->text().toUInt()); clientWidget->connectSocket(ui->host_ip_lineEdit->text(),ui->port_lineEdit->text().toUInt()); }
//function written by Alex Bache // stdinReady() called when script has processed the data on its STDIN and is ready for more void cRunningScript::stdinReady() { //only if we're sending something if (!sendInProgress) return; if (stdinBuffer.length() > 0) { //this shouldn't happen with the new input flow control, but just in case stdinSending = stdinBuffer; stdinBuffer = ""; process->write (stdinSending.toLocal8Bit()); } // endif more data to send to script's STDIN else { sendInProgress = false; } // endelse no more data to send at this time // inform cRunningList only when ALL buffered text has been sent if ((!sendInProgress) && (flowcontrol)) emit textSent (); } // cRunningScript::stdinReady
cRunningScript::~cRunningScript () { dontSignal = true; process->close (); process->deleteLater();; if (unixsocket) delete unixsocket; unixsocket = 0; scriptDying = true; // Prevent further data being sent to this script if (sendInProgress && flowcontrol) { //some text was about to be sent, but it won't be sent anymore... //we behave as if it was sent, to prevent deadlock in cRunningList // (it would endlessly wait for the signal, and no new text would // be sent to any other script) // // scriptDying flag set to prevent the signal causing // further data to be sent to this script. emit textSent (); } }