diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-06 11:43:35 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-06 11:43:35 -0500 |
commit | 1382b1f0c8d40386827dc49cb8fd7eb869e755aa (patch) | |
tree | 7bf475e548de62f837d2a685556cf65a0106c88f /clients/tde | |
parent | 9a3bfffc76e52b18a952016a1793af57b7d92cd4 (diff) | |
download | ulab-1382b1f0c8d40386827dc49cb8fd7eb869e755aa.tar.gz ulab-1382b1f0c8d40386827dc49cb8fd7eb869e755aa.zip |
Fix crash caused by improper SASL initialization
Diffstat (limited to 'clients/tde')
-rw-r--r-- | clients/tde/src/app/remotemdi.cpp | 10 | ||||
-rw-r--r-- | clients/tde/src/part/fpgaprogram/part.cpp | 83 | ||||
-rw-r--r-- | clients/tde/src/part/fpgaprogram/part.h | 1 | ||||
-rw-r--r-- | clients/tde/src/part/fpgaview/part.cpp | 88 | ||||
-rw-r--r-- | clients/tde/src/part/fpgaview/part.h | 1 |
5 files changed, 104 insertions, 79 deletions
diff --git a/clients/tde/src/app/remotemdi.cpp b/clients/tde/src/app/remotemdi.cpp index 8a566e2..eec5144 100644 --- a/clients/tde/src/app/remotemdi.cpp +++ b/clients/tde/src/app/remotemdi.cpp @@ -333,15 +333,7 @@ void RemoteMDI::disconnectFromServer() { unplugActionList("instrumentToolBar_actionlist"); // Close all windows - KMdiIterator<KMdiChildView*> *it = createIterator(); - while (it->currentItem()) { - KMdiChildView *c = dynamic_cast<KMdiChildView*>(it->currentItem()); - if (c) { - closeSpecifiedWindow(c); - } - it->next(); - } - deleteIterator(it); + closeAllViews(); if (m_rsvSvrSocket) { m_rsvSvrSocket->clearPendingData(); diff --git a/clients/tde/src/part/fpgaprogram/part.cpp b/clients/tde/src/part/fpgaprogram/part.cpp index b51c39a..0464c8b 100644 --- a/clients/tde/src/part/fpgaprogram/part.cpp +++ b/clients/tde/src/part/fpgaprogram/part.cpp @@ -79,6 +79,8 @@ FPGAProgramPart::FPGAProgramPart(TQWidget *parentWidget, const char *widgetName, // Create timers m_updateTimer = new TQTimer(this); + m_connectionTimer = new TQTimer(this); + connect(m_connectionTimer, SIGNAL(timeout()), this, SLOT(finishConnectingToServer())); // Create widgets m_base = new FPGAProgramBase(widget()); @@ -154,6 +156,8 @@ bool FPGAProgramPart::closeURL() { } void FPGAProgramPart::disconnectFromServer() { + m_connectionTimer->stop(); + m_updateTimer->stop(); if (m_socket) { m_socket->clearPendingData(); m_socket->close(); @@ -220,45 +224,56 @@ void FPGAProgramPart::finishConnectingToServer() { case 2: // Connection established! // Read magic number and proto version from server - TQDataStream ds(m_socket); - TQ_UINT32 magicnum; - TQ_UINT32 protover; - ds >> magicnum; - ds >> protover; - printf("[DEBUG] Got magic number %d and protocol version %d\n\r", magicnum, protover); fflush(stdout); - - // Request connection to backend server - TQString response; - ds << TQString("SERV"); - ds << TQString(CLIENT_LIBRARY); - ds >> response; -printf("[RAJA DEBUG 400.0] Got '%s' from the server\n\r", response.ascii()); fflush(stdout); - if (response == "OK") { + m_socket->processPendingData(); + if (m_socket->bytesAvailable() > 0) { + TQDataStream ds(m_socket); + TQ_UINT32 magicnum; + TQ_UINT32 protover; + ds >> magicnum; + ds >> protover; + printf("[DEBUG] Got magic number %d and protocol version %d\n\r", magicnum, protover); fflush(stdout); + + // Request connection to backend server + ds << TQString("SERV"); + ds << TQString(CLIENT_LIBRARY); connToServerState = 3; - connToServerConnecting = false; - connect(m_socket, SIGNAL(readyRead()), m_socket, SLOT(processPendingData())); - connect(m_socket, SIGNAL(newDataReceived()), this, SLOT(mainEventLoop())); - m_tickerState = 0; - m_commHandlerState = 0; - m_commHandlerMode = 0; - m_updateTimer->start(FPGA_COMM_TIMEOUT_MS, FALSE); - processLockouts(); - mainEventLoop(); - return; } - else { - TQStringList errorStrings = textForServerError(response); - connToServerState = -1; - connToServerConnecting = false; - disconnectFromServer(); - KMessageBox::error(0, errorStrings[0], errorStrings[1]); - close(); - return; + break; + case 3: + // Read response from server + m_socket->processPendingData(); + if (m_socket->bytesAvailable() > 0) { + TQDataStream ds(m_socket); + TQString response; + ds >> response; +printf("[RAJA DEBUG 400.0] Got '%s' from the server\n\r", response.ascii()); fflush(stdout); + if (response == "OK") { + connToServerState = 4; + connToServerConnecting = false; + connect(m_socket, SIGNAL(readyRead()), m_socket, SLOT(processPendingData())); + connect(m_socket, SIGNAL(newDataReceived()), this, SLOT(mainEventLoop())); + m_tickerState = 0; + m_commHandlerState = 0; + m_commHandlerMode = 0; + m_updateTimer->start(FPGA_COMM_TIMEOUT_MS, FALSE); + processLockouts(); + mainEventLoop(); + return; + } + else { + TQStringList errorStrings = textForServerError(response); + connToServerState = -1; + connToServerConnecting = false; + disconnectFromServer(); + KMessageBox::error(0, errorStrings[0], errorStrings[1]); + close(); + return; + } } break; } - TQTimer::singleShot(0, this, SLOT(finishConnectingToServer())); + m_connectionTimer->start(100, TRUE); } } @@ -277,7 +292,7 @@ int FPGAProgramPart::connectToServer(TQString server) { // Finish connecting when appropriate connToServerState = 0; connToServerConnecting = true; - TQTimer::singleShot(0, this, SLOT(finishConnectingToServer())); + m_connectionTimer->start(100, TRUE); return 0; } diff --git a/clients/tde/src/part/fpgaprogram/part.h b/clients/tde/src/part/fpgaprogram/part.h index f254cbc..5becdde 100644 --- a/clients/tde/src/part/fpgaprogram/part.h +++ b/clients/tde/src/part/fpgaprogram/part.h @@ -79,6 +79,7 @@ namespace RemoteLab TDEKerberosClientSocket* m_socket; FPGAProgramBase* m_base; TQMutex* m_connectionMutex; + TQTimer* m_connectionTimer; TQTimer* m_updateTimer; bool connToServerConnecting; diff --git a/clients/tde/src/part/fpgaview/part.cpp b/clients/tde/src/part/fpgaview/part.cpp index 755f25c..01c23b4 100644 --- a/clients/tde/src/part/fpgaview/part.cpp +++ b/clients/tde/src/part/fpgaview/part.cpp @@ -564,8 +564,9 @@ K_EXPORT_COMPONENT_FACTORY(libremotelab_fpgaviewer, RemoteLab::Factory) FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObject *parent, const char *name, const TQStringList&) : RemoteInstrumentPart( parent, name ), m_socket(0), m_base(0), connToServerConnecting(false), connToServerState(-1), connToServerTimeoutTimer(NULL), m_interfaceMode(BasicInterfaceMode), - m_commHandlerState(0), m_connectionActiveAndValid(false), m_tickerState(0), m_remoteInputModeEnabled(false), m_4bitInputValue(0), m_4bitOutputValue(0), m_8bitInputValue(0), m_8bitOutputValue(0), - m_16bitInputValue(0), m_16bitOutputValue(0), m_7segDigit3OutputValue(0xffffffff), m_7segDigit2OutputValue(0xffffffff), m_7segDigit1OutputValue(0xffffffff), m_7segDigit0OutputValue(0xffffffff), + m_commHandlerState(0), m_commHandlerMode(0), m_connectionActiveAndValid(false), m_tickerState(0), m_remoteInputModeEnabled(false), m_4bitInputValue(0), m_4bitOutputValue(0), + m_8bitInputValue(0), m_8bitOutputValue(0), m_16bitInputValue(0), m_16bitOutputValue(0), m_7segDigit3OutputValue(0xffffffff), + m_7segDigit2OutputValue(0xffffffff), m_7segDigit1OutputValue(0xffffffff), m_7segDigit0OutputValue(0xffffffff), m_batchOutputFile(NULL), m_dataOutputFile(NULL) { // Initialize mutex @@ -577,6 +578,8 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj // Create timers m_updateTimer = new TQTimer(this); + m_connectionTimer = new TQTimer(this); + connect(m_connectionTimer, SIGNAL(timeout()), this, SLOT(finishConnectingToServer())); // Create widgets m_base = new FPGAViewBase(widget()); @@ -984,6 +987,8 @@ bool FPGAViewPart::closeURL() { } void FPGAViewPart::disconnectFromServer() { + m_connectionTimer->stop(); + m_updateTimer->stop(); if (m_socket) { m_socket->clearPendingData(); m_socket->close(); @@ -1050,45 +1055,56 @@ void FPGAViewPart::finishConnectingToServer() { case 2: // Connection established! // Read magic number and proto version from server - TQDataStream ds(m_socket); - TQ_UINT32 magicnum; - TQ_UINT32 protover; - ds >> magicnum; - ds >> protover; - printf("[DEBUG] Got magic number %d and protocol version %d\n\r", magicnum, protover); fflush(stdout); - - // Request connection to backend server - TQString response; - ds << TQString("SERV"); - ds << TQString(CLIENT_LIBRARY); - ds >> response; -printf("[RAJA DEBUG 400.0] Got '%s' from the server\n\r", response.ascii()); fflush(stdout); - if (response == "OK") { + m_socket->processPendingData(); + if (m_socket->bytesAvailable() > 0) { + TQDataStream ds(m_socket); + TQ_UINT32 magicnum; + TQ_UINT32 protover; + ds >> magicnum; + ds >> protover; + printf("[DEBUG] Got magic number %d and protocol version %d\n\r", magicnum, protover); fflush(stdout); + + // Request connection to backend server + ds << TQString("SERV"); + ds << TQString(CLIENT_LIBRARY); connToServerState = 3; - connToServerConnecting = false; - connect(m_socket, SIGNAL(readyRead()), m_socket, SLOT(processPendingData())); - connect(m_socket, SIGNAL(newDataReceived()), this, SLOT(updateDisplay())); - m_tickerState = 0; - m_commHandlerState = 0; - m_commHandlerMode = 0; - m_updateTimer->start(FPGA_COMM_TIMEOUT_MS, FALSE); - processLockouts(); - updateDisplay(); - return; } - else { - TQStringList errorStrings = textForServerError(response); - connToServerState = -1; - connToServerConnecting = false; - disconnectFromServer(); - KMessageBox::error(0, errorStrings[0], errorStrings[1]); - close(); - return; + break; + case 3: + // Read response from server + m_socket->processPendingData(); + if (m_socket->bytesAvailable() > 0) { + TQDataStream ds(m_socket); + TQString response; + ds >> response; +printf("[RAJA DEBUG 400.0] Got '%s' from the server\n\r", response.ascii()); fflush(stdout); + if (response == "OK") { + connToServerState = 4; + connToServerConnecting = false; + connect(m_socket, SIGNAL(readyRead()), m_socket, SLOT(processPendingData())); + connect(m_socket, SIGNAL(newDataReceived()), this, SLOT(updateDisplay())); + m_tickerState = 0; + m_commHandlerState = 0; + m_commHandlerMode = 0; + m_updateTimer->start(FPGA_COMM_TIMEOUT_MS, FALSE); + processLockouts(); + updateDisplay(); + return; + } + else { + TQStringList errorStrings = textForServerError(response); + connToServerState = -1; + connToServerConnecting = false; + disconnectFromServer(); + KMessageBox::error(0, errorStrings[0], errorStrings[1]); + close(); + return; + } } break; } - TQTimer::singleShot(0, this, SLOT(finishConnectingToServer())); + m_connectionTimer->start(100, TRUE); } } @@ -1107,7 +1123,7 @@ int FPGAViewPart::connectToServer(TQString server) { // Finish connecting when appropriate connToServerState = 0; connToServerConnecting = true; - TQTimer::singleShot(0, this, SLOT(finishConnectingToServer())); + m_connectionTimer->start(100, TRUE); return 0; } diff --git a/clients/tde/src/part/fpgaview/part.h b/clients/tde/src/part/fpgaview/part.h index 02d2773..a0b0463 100644 --- a/clients/tde/src/part/fpgaview/part.h +++ b/clients/tde/src/part/fpgaview/part.h @@ -186,6 +186,7 @@ namespace RemoteLab TDEKerberosClientSocket* m_socket; FPGAViewBase* m_base; TQMutex* m_connectionMutex; + TQTimer* m_connectionTimer; TQTimer* m_updateTimer; bool connToServerConnecting; |