author | dwmw2 <dwmw2> | 2003-06-07 15:49:06 (UTC) |
---|---|---|
committer | dwmw2 <dwmw2> | 2003-06-07 15:49:06 (UTC) |
commit | e02157a68d186a17778d3b393a327660df5fbac3 (patch) (side-by-side diff) | |
tree | 3abede8e557239579041511b973c15a2d9e0f273 | |
parent | 1a7addc9f586b35c4c4f5025030349c3064bc3b7 (diff) | |
download | opie-e02157a68d186a17778d3b393a327660df5fbac3.zip opie-e02157a68d186a17778d3b393a327660df5fbac3.tar.gz opie-e02157a68d186a17778d3b393a327660df5fbac3.tar.bz2 |
Don't close the tty before invoking pppd. It makes it difficult to use.
-rw-r--r-- | noncore/settings/networksettings/ppp/connect.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/noncore/settings/networksettings/ppp/connect.cpp b/noncore/settings/networksettings/ppp/connect.cpp index 798431b..6905d79 100644 --- a/noncore/settings/networksettings/ppp/connect.cpp +++ b/noncore/settings/networksettings/ppp/connect.cpp @@ -735,193 +735,196 @@ void ConnectWidget::timerEvent(QTimerEvent *) { // The incrementing of the scriptindex MUST be before the // call to setExpect otherwise the expect will miss a string that is // already in the buffer. scriptindex++; if ( loopnest > (MAXLOOPNEST-2) ) { bm += i18n("ERROR: Nested too deep, ignored."); vmain=20; cancelbutton(); QMessageBox::critical(0, "error", i18n("Loops nested too deeply!")); } else { setExpect(scriptArgument); loopstartindex[loopnest] = scriptindex; loopstr[loopnest] = scriptArgument; loopend = false; loopnest++; } messg->setText(bm); emit debugMessage(bm); } if (scriptCommand == "LoopEnd") { QString bm = i18n("Loop End %1").arg(scriptArgument); if ( loopnest <= 0 ) { bm = i18n("LoopEnd without matching Start! Line: %1").arg(bm); vmain=20; cancelbutton(); QMessageBox::critical(0, "error", bm); return; } else { // NB! The incrementing of the scriptindex MUST be before the // call to setExpect otherwise the expect will miss a string // that is already in the buffer. scriptindex++; setExpect(scriptArgument); loopnest--; loopend = true; } messg->setText(bm); emit debugMessage(bm); } } } // this is a subroutine for the "Answer" script option if(vmain == 150) { if(!expecting) { writeline(_ifaceppp->data()->modemAnswerStr()); setExpect(_ifaceppp->data()->modemAnswerResp()); vmain = 2; scriptindex++; return; } } if(vmain == 30) { // if (termwindow->isVisible()) // return; // if (termwindow->pressedContinue()) // vmain = 10; // else cancelbutton(); } if(vmain == 10) { if(!expecting) { int result; timeout_timer->stop(); if_timeout_timer->stop(); // better be sure. // stop reading of data _ifaceppp->modem()->stop(); if(_ifaceppp->data()->authMethod() == AUTH_TERMINAL) { // if (termwindow) { // delete termwindow; // termwindow = 0L; // this->show(); // } else { // termwindow = new LoginTerm(0L, 0L); // hide(); // termwindow->show(); // vmain = 30; // return; // } } // Close the tty. This prevents the QTimer::singleShot() in // Modem::readtty() from re-enabling the socket notifier. // The port is still held open by the helper process. - _ifaceppp->modem()->closetty(); + + /* Er, there _is_ not QTimer::singleShot() in Modem::readtty(), + and closing the thing prevents pppd from using it later. */ + //_ifaceppp->modem()->closetty(); killTimer( main_timer_ID ); if_timeout_timer->start(_ifaceppp->data()->pppdTimeout()*1000); qDebug( "started if timeout timer with %i", _ifaceppp->data()->pppdTimeout()*1000); // find out PPP interface and notify the stats module // stats->setUnit(pppInterfaceNumber()); qApp->flushX(); semaphore = true; result = execppp(); emit debugMessage(i18n("Starting pppd...")); qDebug("execppp() returned with return-code %i", result ); if(result) { if(!_ifaceppp->data()->autoDNS()) adddns( _ifaceppp ); // O.K we are done here, let's change over to the if_waiting loop // where we wait for the ppp if (interface) to come up. emit if_waiting_signal(); } else { // starting pppd wasn't successful. Error messages were // handled by execppp(); if_timeout_timer->stop(); this->hide(); messg->setText(""); // p_kppp->quit_b->setFocus(); // p_kppp->show(); qApp->processEvents(); _ifaceppp->modem()->hangup(); emit stopAccounting(); // p_kppp->con_win->stopClock(); _ifaceppp->modem()->closetty(); _ifaceppp->modem()->unlockdevice(); } return; } } // this is a "wait until cancel" entry if(vmain == 20) { } } void ConnectWidget::set_con_speed_string() { // Here we are trying to determine the speed at which we are connected. // Usually the modem responds after connect with something like // CONNECT 115200, so all we need to do is find the number after CONNECT // or whatever the modemConnectResp() is. // p_kppp->con_speed = _ifaceppp->modem()->parseModemSpeed(myreadbuffer); } void ConnectWidget::readChar(unsigned char c) { if(semaphore) return; readbuffer += c; myreadbuffer += c; // While in scanning mode store each char to the scan buffer // for use in the prompt command if( scanning ) scanbuffer += c; // add to debug window emit debugPutChar(c); checkBuffers(); } void ConnectWidget::checkBuffers() { // Let's check if we are finished with scanning: // The scanstring have to be in the buffer and the latest character // was a carriage return or an linefeed (depending on modem setup) if( scanning && scanbuffer.contains(scanstr) && ( scanbuffer.right(1) == "\n" || scanbuffer.right(1) == "\r") ) { scanning = false; int vstart = scanbuffer.find( scanstr ) + scanstr.length(); scanvar = scanbuffer.mid( vstart, scanbuffer.length() - vstart); scanvar = scanvar.stripWhiteSpace(); // Show the Variabel content in the debug window QString sv = i18n("Scan Var: %1").arg(scanvar); |