Fix crashes in servers

Start work on FPGA client
master
Timothy Pearson 12 years ago
parent e9dafbb9d0
commit 963501ff41

@ -30,7 +30,7 @@ using namespace std;
#include "dialogs/selectserverdlg.h"
RemoteMDI::RemoteMDI()
: KMdiMainFrm(0, "RemoteMDI", KMdi::ChildframeMode), m_children(0), m_rsvSvrSocket(NULL), connToServerConnecting(false), connToServerState(-1), connToServerTimeoutTimer(NULL)
: KMdiMainFrm(0, "RemoteMDI", KMdi::ChildframeMode), m_instrumentActionListPlugged(false), m_children(0), m_rsvSvrSocket(NULL), connToServerConnecting(false), connToServerState(-1), connToServerTimeoutTimer(NULL)
{
setXMLFile("remotelabui.rc");
@ -420,9 +420,13 @@ void RemoteMDI::currentChanged(KMdiChildView *current) {
RemoteLab::InstrumentView* view = dynamic_cast<RemoteLab::InstrumentView*>(current);
// Plug/unpug menus
unplugActionList("selectedInstrument_actionlist");
if (m_instrumentActionListPlugged) {
unplugActionList("selectedInstrument_actionlist");
m_instrumentActionListPlugged = false;
}
if (view) {
plugActionList("selectedInstrument_actionlist", view->menuActionList());
m_instrumentActionListPlugged = true;
}
// Update status bar and list box

@ -77,6 +77,7 @@ class RemoteMDI : public KMdiMainFrm
private:
TQString m_mainStatusBarMessage;
TQString m_windowStatusBarMessage;
bool m_instrumentActionListPlugged;
unsigned m_children;
TQString m_serverHost;

@ -47,15 +47,175 @@
</property>
<widget class="TQGroupBox" row="0" column="0">
<property name="name">
<cstring>group8Bit</cstring>
<cstring>group8BitInput</cstring>
</property>
<property name="title">
<string>8-Bit Input Values</string>
<string></string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="FPGALed" row="0" column="0">
<property name="name">
<cstring>group8BitInputLED7</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="1">
<property name="name">
<cstring>group8BitInputLED6</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="2">
<property name="name">
<cstring>group8BitInputLED5</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="3">
<property name="name">
<cstring>group8BitInputLED4</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="4">
<property name="name">
<cstring>group8BitInputLED3</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="5">
<property name="name">
<cstring>group8BitInputLED2</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="6">
<property name="name">
<cstring>group8BitInputLED1</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="7">
<property name="name">
<cstring>group8BitInputLED0</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="8">
<property name="name">
<cstring>group8BitInputValueText</cstring>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="1" column="0">
<property name="name">
<cstring>group8BitOutput</cstring>
</property>
<property name="title">
<string>8-Bit Output Values</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="FPGALed" row="0" column="0">
<property name="name">
<cstring>group8BitOutputLED7</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="1">
<property name="name">
<cstring>group8BitOutputLED6</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="2">
<property name="name">
<cstring>group8BitOutputLED5</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="3">
<property name="name">
<cstring>group8BitOutputLED4</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="4">
<property name="name">
<cstring>group8BitOutputLED3</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="5">
<property name="name">
<cstring>group8BitOutputLED2</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="6">
<property name="name">
<cstring>group8BitOutputLED1</cstring>
</property>
</widget>
<widget class="FPGALed" row="0" column="7">
<property name="name">
<cstring>group8BitOutputLED0</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="8">
<property name="name">
<cstring>group8BitOutputValueText</cstring>
</property>
</widget>
</grid>
</widget>
<widget class="TQGroupBox" row="2" column="0">
<property name="name">
<cstring>group16BitIO</cstring>
</property>
<property name="title">
<string>16-Bit I/O</string>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="TQLabel" row="0" column="0">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<cstring>Input:</cstring>
</property>
</widget>
<widget class="KIntSpinBox" row="0" column="1">
<property name="name">
<cstring>group16BitInputValue</cstring>
</property>
<property name="prefix">
<cstring>0x</cstring>
</property>
<property name="value">
<number>0</number>
</property>
<property name="minValue">
<number>0</number>
</property>
<property name="maxValue">
<number>65535</number>
</property>
<property name="base">
<number>16</number>
</property>
</widget>
<widget class="TQLabel" row="0" column="2">
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="text">
<cstring>Output:</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="3">
<property name="name">
<cstring>group16BitOutputValue</cstring>
</property>
<property name="text">
<cstring></cstring>
</property>
</widget>
</grid>
</widget>
</grid>
@ -71,6 +231,7 @@
<includes>
<include location="local" impldecl="in implementation">tracewidget.h</include>
<include location="local" impldecl="in implementation">floatspinbox.h</include>
<include location="local" impldecl="in implementation">part.h</include>
</includes>
<layoutdefaults spacing="3" margin="6"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>

@ -37,24 +37,52 @@
#include <tqmutex.h>
#include <tqeventloop.h>
#include <tqapplication.h>
#include <tqgroupbox.h>
#include <unistd.h> //access()
#include <stdint.h>
#include "tracewidget.h"
#include "floatspinbox.h"
#include "layout.h"
#define SERVER_TIMEOUT_MS 10000
FPGALed::FPGALed(TQWidget *parent, const char *name)
: KLed(parent, name), m_clickable(true)
{
connect(this, SIGNAL(clicked()), this, SLOT(toggle()));
setColor(green);
setOffColor(TQApplication::palette(this).active().base().dark(200));
}
void FPGALed::setClickable(bool clickable) {
if ((!clickable) && (m_clickable)) {
disconnect(this, SIGNAL(clicked()), this, SLOT(toggle()));
}
else if ((clickable) && (!m_clickable)) {
connect(this, SIGNAL(clicked()), this, SLOT(toggle()));
}
m_clickable = clickable;
}
void FPGALed::mouseReleaseEvent(TQMouseEvent *e) {
if (e->button() == TQMouseEvent::LeftButton) {
emit(clicked());
}
}
namespace RemoteLab {
typedef KParts::GenericFactory<RemoteLab::FPGAViewPart> Factory;
#define CLIENT_LIBRARY "libremotelab_fpgaviewer"
K_EXPORT_COMPONENT_FACTORY(libremotelab_fpgaviewer, RemoteLab::Factory)
#define LED_SIZE 20,20
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)
: RemoteInstrumentPart( parent, name ), m_socket(0), m_base(0), connToServerConnecting(false), connToServerState(-1), connToServerTimeoutTimer(NULL), m_interfaceMode(BasicInterfaceMode),
remoteInputModeEnabled(false), m_8bitInputValue(0), m_8bitOutputValue(0)
{
// Initialize mutex
m_connectionMutex = new TQMutex(false);
@ -82,7 +110,60 @@ FPGAViewPart::FPGAViewPart(TQWidget *parentWidget, const char *widgetName, TQObj
m_modeAdvancedEnabled = new KToggleAction(i18n("Advanced"), KShortcut(), TQT_TQOBJECT(this), TQT_SLOT(switchToAdvancedMode()), ac, "mode_advanced_enabled");
m_modeSubMenu->insert(m_modeAdvancedEnabled);
processLockouts();
// Initialize widgets
m_base->group8BitInputLED7->setFixedSize(LED_SIZE);
m_base->group8BitInputLED6->setFixedSize(LED_SIZE);
m_base->group8BitInputLED5->setFixedSize(LED_SIZE);
m_base->group8BitInputLED4->setFixedSize(LED_SIZE);
m_base->group8BitInputLED3->setFixedSize(LED_SIZE);
m_base->group8BitInputLED2->setFixedSize(LED_SIZE);
m_base->group8BitInputLED1->setFixedSize(LED_SIZE);
m_base->group8BitInputLED0->setFixedSize(LED_SIZE);
m_base->group8BitOutputLED7->setFixedSize(LED_SIZE);
m_base->group8BitOutputLED6->setFixedSize(LED_SIZE);
m_base->group8BitOutputLED5->setFixedSize(LED_SIZE);
m_base->group8BitOutputLED4->setFixedSize(LED_SIZE);
m_base->group8BitOutputLED3->setFixedSize(LED_SIZE);
m_base->group8BitOutputLED2->setFixedSize(LED_SIZE);
m_base->group8BitOutputLED1->setFixedSize(LED_SIZE);
m_base->group8BitOutputLED0->setFixedSize(LED_SIZE);
m_base->group8BitInputLED7->setState(KLed::Off);
m_base->group8BitInputLED6->setState(KLed::Off);
m_base->group8BitInputLED5->setState(KLed::Off);
m_base->group8BitInputLED4->setState(KLed::Off);
m_base->group8BitInputLED3->setState(KLed::Off);
m_base->group8BitInputLED2->setState(KLed::Off);
m_base->group8BitInputLED1->setState(KLed::Off);
m_base->group8BitInputLED0->setState(KLed::Off);
m_base->group8BitOutputLED7->setState(KLed::Off);
m_base->group8BitOutputLED6->setState(KLed::Off);
m_base->group8BitOutputLED5->setState(KLed::Off);
m_base->group8BitOutputLED4->setState(KLed::Off);
m_base->group8BitOutputLED3->setState(KLed::Off);
m_base->group8BitOutputLED2->setState(KLed::Off);
m_base->group8BitOutputLED1->setState(KLed::Off);
m_base->group8BitOutputLED0->setState(KLed::Off);
m_base->group8BitOutputLED7->setClickable(false);
m_base->group8BitOutputLED6->setClickable(false);
m_base->group8BitOutputLED5->setClickable(false);
m_base->group8BitOutputLED4->setClickable(false);
m_base->group8BitOutputLED3->setClickable(false);
m_base->group8BitOutputLED2->setClickable(false);
m_base->group8BitOutputLED1->setClickable(false);
m_base->group8BitOutputLED0->setClickable(false);
connect(m_base->group8BitInputLED7, SIGNAL(clicked()), this, SLOT(process8BitInputChanges()));
connect(m_base->group8BitInputLED6, SIGNAL(clicked()), this, SLOT(process8BitInputChanges()));
connect(m_base->group8BitInputLED5, SIGNAL(clicked()), this, SLOT(process8BitInputChanges()));
connect(m_base->group8BitInputLED4, SIGNAL(clicked()), this, SLOT(process8BitInputChanges()));
connect(m_base->group8BitInputLED3, SIGNAL(clicked()), this, SLOT(process8BitInputChanges()));
connect(m_base->group8BitInputLED2, SIGNAL(clicked()), this, SLOT(process8BitInputChanges()));
connect(m_base->group8BitInputLED1, SIGNAL(clicked()), this, SLOT(process8BitInputChanges()));
connect(m_base->group8BitInputLED0, SIGNAL(clicked()), this, SLOT(process8BitInputChanges()));
processAllGraphicsUpdates();
TQTimer::singleShot(0, this, TQT_SLOT(postInit()));
}
@ -96,6 +177,52 @@ FPGAViewPart::~FPGAViewPart() {
delete m_connectionMutex;
}
void FPGAViewPart::processAllGraphicsUpdates() {
// This is an expensive operation
// Use it sparingly!
process8BitInputChanges();
process8BitOutputChanges();
processLockouts();
}
void FPGAViewPart::process8BitInputChanges() {
// Read LED status into m_8bitInputValue
m_8bitInputValue = 0;
if (m_base->group8BitInputLED7->state() == KLed::On) m_8bitInputValue |= 0x80;
if (m_base->group8BitInputLED6->state() == KLed::On) m_8bitInputValue |= 0x40;
if (m_base->group8BitInputLED5->state() == KLed::On) m_8bitInputValue |= 0x20;
if (m_base->group8BitInputLED4->state() == KLed::On) m_8bitInputValue |= 0x10;
if (m_base->group8BitInputLED3->state() == KLed::On) m_8bitInputValue |= 0x08;
if (m_base->group8BitInputLED2->state() == KLed::On) m_8bitInputValue |= 0x04;
if (m_base->group8BitInputLED1->state() == KLed::On) m_8bitInputValue |= 0x02;
if (m_base->group8BitInputLED0->state() == KLed::On) m_8bitInputValue |= 0x01;
m_base->group8BitInputValueText->setText(TQString("0x%1").arg(m_8bitInputValue, 0, 16));
if (remoteInputModeEnabled) {
m_base->group8BitInput->setTitle(i18n("8-Bit Input Values") + " [" + i18n("Remote Input Mode") + "]");
}
else {
m_base->group8BitInput->setTitle(i18n("8-Bit Input Values") + " [" + i18n("Local Input Mode") + "]");
}
}
void FPGAViewPart::process8BitOutputChanges() {
// Write m_8bitOutputValue to LEDs
m_base->group8BitOutputLED7->setState((m_8bitInputValue & 0x80)?KLed::On:KLed::Off);
m_base->group8BitOutputLED6->setState((m_8bitInputValue & 0x80)?KLed::On:KLed::Off);
m_base->group8BitOutputLED5->setState((m_8bitInputValue & 0x80)?KLed::On:KLed::Off);
m_base->group8BitOutputLED4->setState((m_8bitInputValue & 0x80)?KLed::On:KLed::Off);
m_base->group8BitOutputLED3->setState((m_8bitInputValue & 0x80)?KLed::On:KLed::Off);
m_base->group8BitOutputLED2->setState((m_8bitInputValue & 0x80)?KLed::On:KLed::Off);
m_base->group8BitOutputLED1->setState((m_8bitInputValue & 0x80)?KLed::On:KLed::Off);
m_base->group8BitOutputLED0->setState((m_8bitInputValue & 0x80)?KLed::On:KLed::Off);
m_base->group8BitOutputValueText->setText(TQString("0x%1").arg(m_8bitOutputValue, 0, 16));
}
void FPGAViewPart::processLockouts() {
TQWidget* mainWidget = widget();
if (mainWidget) {
@ -183,7 +310,7 @@ void FPGAViewPart::finishConnectingToServer() {
case 0:
if (!connToServerTimeoutTimer) {
connToServerTimeoutTimer = new TQTimer;
connToServerTimeoutTimer->start(5000, TRUE);
connToServerTimeoutTimer->start(SERVER_TIMEOUT_MS, TRUE);
}
if ((m_socket->state() == TQSocket::Connecting) || (m_socket->state() == TQSocket::HostLookup)) {
if (!connToServerTimeoutTimer->isActive()) {
@ -196,7 +323,7 @@ void FPGAViewPart::finishConnectingToServer() {
else {
if (m_socket->state() == TQSocket::Connected) {
printf("[DEBUG] Initial connection established...\n\r"); fflush(stdout);
m_socket->setDataTimeout(5000);
m_socket->setDataTimeout(SERVER_TIMEOUT_MS);
m_socket->setUsingKerberos(true);
connToServerState = 1;
}

@ -29,6 +29,7 @@
#include <kparts/statusbarextension.h>
#include <kparts/part.h>
#include <kurl.h>
#include <kled.h>
#include <tqtrla.h>
@ -40,6 +41,24 @@ class TQTimer;
class TQMutex;
class FPGAViewBase;
class FPGALed : public KLed
{
Q_OBJECT
public:
FPGALed(TQWidget *parent=0, const char *name=0);
void setClickable(bool clickable);
protected:
virtual void mouseReleaseEvent(TQMouseEvent *);
signals:
void clicked();
private:
bool m_clickable;
};
namespace RemoteLab
{
class FPGAViewPart : public KParts::RemoteInstrumentPart
@ -76,6 +95,10 @@ namespace RemoteLab
void switchToBasicMode();
void switchToIntermediateMode();
void switchToAdvancedMode();
void processAllGraphicsUpdates();
void process8BitInputChanges();
void process8BitOutputChanges();
private:
TDEKerberosClientSocket* m_socket;
@ -94,6 +117,10 @@ namespace RemoteLab
KToggleAction* m_modeAdvancedEnabled;
InterfaceMode m_interfaceMode;
bool remoteInputModeEnabled;
unsigned char m_8bitInputValue;
unsigned char m_8bitOutputValue;
};
}

@ -97,7 +97,7 @@ static int logSASLMessages(void *context __attribute__((unused)), int priority,
return SASL_OK;
}
TDEKerberosClientSocket::TDEKerberosClientSocket(TQObject *parent, const char *name) : TQSocket(parent, name), m_kerberosRequested(false), m_criticalSection(0), m_bufferLength(0), m_krbInitRunning(false), m_krbInitState(-1), m_dataTimeout(-1), m_canary(NULL), m_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE) {
TDEKerberosClientSocket::TDEKerberosClientSocket(TQObject *parent, const char *name) : TQSocket(parent, name), m_kerberosRequested(false), m_criticalSection(0), m_bufferLength(0), m_krbInitRunning(false), m_krbInitState(-1), m_dataTimeout(-1), kerberosInitLoopTimer(NULL), m_canary(NULL), m_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE) {
saslData = new SASLDataPrivate;
saslData->m_krbConnection = NULL;
m_buffer = new TQBuffer();
@ -108,6 +108,11 @@ TDEKerberosClientSocket::~TDEKerberosClientSocket() {
if (m_canary) {
*m_canary = true;
}
if (kerberosInitLoopTimer) {
kerberosInitLoopTimer->stop();
delete kerberosInitLoopTimer;
kerberosInitLoopTimer = NULL;
}
m_buffer->close();
delete m_buffer;
delete saslData;
@ -795,6 +800,11 @@ void TDEKerberosClientSocket::continueKerberosInitialization() {
m_negotiatedMaxBufferSize = NET_SEC_BUF_SIZE;
}
else {
// For some reason m_negotiatedMaxBufferSize can be set negative under certain circumstances
// Prevent that from happening!
if (m_negotiatedMaxBufferSize < NET_SEC_BUF_SIZE) {
m_negotiatedMaxBufferSize = NET_SEC_BUF_SIZE;
}
printf("[DEBUG] Maximum buffer size: %d\n", m_negotiatedMaxBufferSize);
}
m_krbInitState = 3;
@ -810,7 +820,7 @@ void TDEKerberosClientSocket::continueKerberosInitialization() {
}
break;
}
TQTimer::singleShot(0, this, SLOT(continueKerberosInitialization()));
if (kerberosInitLoopTimer) kerberosInitLoopTimer->start(0, TRUE);
}
}
@ -869,7 +879,11 @@ int TDEKerberosClientSocket::initializeKerberosInterface() {
m_krbInitRunning = true;
m_krbInitState = 0;
TQTimer::singleShot(0, this, SLOT(continueKerberosInitialization()));
if (!kerberosInitLoopTimer) {
kerberosInitLoopTimer = new TQTimer();
connect(kerberosInitLoopTimer, SIGNAL(timeout()), this, SLOT(continueKerberosInitialization()));
}
if (kerberosInitLoopTimer) kerberosInitLoopTimer->start(0, TRUE);
return 0;
}

@ -95,6 +95,7 @@ class TDEKerberosClientSocket : public TQSocket
int m_krbInitState;
TQString m_prevStatusMessage;
int m_dataTimeout;
TQTimer* kerberosInitLoopTimer;
bool* m_canary;
private:

@ -97,7 +97,7 @@ static int logSASLMessages(void *context __attribute__((unused)), int priority,
return SASL_OK;
}
TDEKerberosServerSocket::TDEKerberosServerSocket(TQObject *parent, const char *name) : TQSocket(parent, name), m_kerberosRequested(false), m_criticalSection(0), m_bufferLength(0), m_krbInitRunning(false), m_krbInitState(-1), m_dataTimeout(-1), m_canary(NULL), m_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE) {
TDEKerberosServerSocket::TDEKerberosServerSocket(TQObject *parent, const char *name) : TQSocket(parent, name), m_kerberosRequested(false), m_criticalSection(0), m_bufferLength(0), m_krbInitRunning(false), m_krbInitState(-1), m_dataTimeout(-1), kerberosInitLoopTimer(NULL), m_canary(NULL), m_negotiatedMaxBufferSize(NET_SEC_BUF_SIZE) {
saslData = new SASLDataPrivate;
saslData->m_krbConnection = NULL;
m_buffer = new TQBuffer();
@ -108,6 +108,11 @@ TDEKerberosServerSocket::~TDEKerberosServerSocket() {
if (m_canary) {
*m_canary = true;
}
if (kerberosInitLoopTimer) {
kerberosInitLoopTimer->stop();
delete kerberosInitLoopTimer;
kerberosInitLoopTimer = NULL;
}
m_buffer->close();
delete m_buffer;
delete saslData;
@ -794,6 +799,20 @@ void TDEKerberosServerSocket::continueKerberosInitialization() {
else {
printf("[DEBUG] Authenticated SSF: %d\n", *ssf);
}
m_krbInitResult = sasl_getprop(saslData->m_krbConnection, SASL_MAXOUTBUF, (const void **)&m_negotiatedMaxBufferSize);
if (m_krbInitResult != SASL_OK) {
printf("[WARNING] Unable to determine maximum buffer size!\n\r");
m_negotiatedMaxBufferSize = NET_SEC_BUF_SIZE;
}
else {
// For some reason m_negotiatedMaxBufferSize can be set negative under certain circumstances
// Prevent that from happening!
if (m_negotiatedMaxBufferSize < NET_SEC_BUF_SIZE) {
m_negotiatedMaxBufferSize = NET_SEC_BUF_SIZE;
}
printf("[DEBUG] Maximum buffer size: %d\n", m_negotiatedMaxBufferSize);
}
m_krbInitState = 4;
m_krbInitRunning = false;
setStatusMessage(i18n("Kerberos connection established"));
@ -807,7 +826,7 @@ void TDEKerberosServerSocket::continueKerberosInitialization() {
}
break;
}
TQTimer::singleShot(0, this, SLOT(continueKerberosInitialization()));
if (kerberosInitLoopTimer) kerberosInitLoopTimer->start(0, TRUE);
}
}
@ -884,7 +903,11 @@ int TDEKerberosServerSocket::initializeKerberosInterface() {
m_krbInitRunning = true;
m_krbInitState = 0;
TQTimer::singleShot(0, this, SLOT(continueKerberosInitialization()));
if (!kerberosInitLoopTimer) {
kerberosInitLoopTimer = new TQTimer();
connect(kerberosInitLoopTimer, SIGNAL(timeout()), this, SLOT(continueKerberosInitialization()));
}
if (kerberosInitLoopTimer) kerberosInitLoopTimer->start(0, TRUE);
return 0;
}

@ -99,6 +99,7 @@ class TDEKerberosServerSocket : public TQSocket
int m_krbInitState;
TQString m_prevStatusMessage;
int m_dataTimeout;
TQTimer* kerberosInitLoopTimer;
bool* m_canary;
private:

@ -45,7 +45,7 @@ struct exit_exception {
instance of this class.
*/
AuthSocket::AuthSocket(int sock, TQObject *parent, const char *name) :
TDEKerberosServerSocket(parent, name), m_criticalSection(0), m_stationID(-1), m_bound(false), m_servActive(false), m_servState(0), m_servClientSocket(NULL), m_servClientTimeout(NULL), m_config(static_cast<AuthServer*>(parent)->m_config), m_database(NULL), m_databaseStationsCursor(NULL),
TDEKerberosServerSocket(parent, name), m_criticalSection(0), m_stationID(-1), m_bound(false), m_servActive(false), m_servState(0), m_servClientSocket(NULL), m_servClientTimeout(NULL), m_loopTimer(NULL), m_config(static_cast<AuthServer*>(parent)->m_config), m_database(NULL), m_databaseStationsCursor(NULL),
m_databaseServicesCursor(NULL), m_databaseServiceTypesCursor(NULL), m_databasePermissionsCursor(NULL), m_databaseActivityCursor(NULL)
{
@ -61,6 +61,11 @@ AuthSocket::AuthSocket(int sock, TQObject *parent, const char *name) :
}
AuthSocket::~AuthSocket() {
if (m_loopTimer) {
m_loopTimer->stop();
delete m_loopTimer;
m_loopTimer = NULL;
}
if (m_databaseStationsCursor) {
delete m_databaseStationsCursor;
}
@ -260,7 +265,7 @@ void AuthSocket::servLoop() {
void AuthSocket::commandLoop() {
if (m_servActive) {
servLoop();
TQTimer::singleShot(0, this, SLOT(commandLoop()));
if (m_loopTimer) m_loopTimer->start(0, TRUE);
return;
}
@ -427,7 +432,7 @@ void AuthSocket::commandLoop() {
}
m_criticalSection--;
TQTimer::singleShot(0, this, SLOT(commandLoop()));
if (m_loopTimer) m_loopTimer->start(0, TRUE);
return;
}
}
@ -438,7 +443,11 @@ void AuthSocket::commandLoop() {
}
int AuthSocket::enterCommandLoop() {
TQTimer::singleShot(0, this, SLOT(commandLoop()));
if (!m_loopTimer) {
m_loopTimer = new TQTimer();
connect(m_loopTimer, SIGNAL(timeout()), this, SLOT(commandLoop()));
}
if (m_loopTimer) m_loopTimer->start(0, TRUE);
return 0;
}

@ -74,6 +74,8 @@ class AuthSocket : public TDEKerberosServerSocket
TQString m_srvServiceHostName;
int m_srvServicePort;
TQTimer* m_loopTimer;
KSimpleConfig* m_config;
TQSqlDatabase* m_database;
TQSqlCursor* m_databaseStationsCursor;

@ -57,7 +57,7 @@ struct exit_exception {
instance of this class.
*/
FPGASocket::FPGASocket(int sock, TQObject *parent, const char *name) :
TDEKerberosServerSocket(parent, name), m_criticalSection(0), m_config(static_cast<FPGAServer*>(parent)->m_config) {
TDEKerberosServerSocket(parent, name), m_criticalSection(0), m_loopTimer(NULL), m_config(static_cast<FPGAServer*>(parent)->m_config) {
setServiceName("remotefpga");
@ -68,7 +68,11 @@ FPGASocket::FPGASocket(int sock, TQObject *parent, const char *name) :
}
FPGASocket::~FPGASocket() {
//
if (m_loopTimer) {
m_loopTimer->stop();
delete m_loopTimer;
m_loopTimer = NULL;
}
}
void FPGASocket::close() {
@ -177,7 +181,7 @@ void FPGASocket::commandLoop() {
}
}
m_criticalSection--;
TQTimer::singleShot(0, this, SLOT(commandLoop()));
if (m_loopTimer) m_loopTimer->start(0, TRUE);
return;
}
catch (...) {
@ -187,7 +191,11 @@ void FPGASocket::commandLoop() {
}
int FPGASocket::enterCommandLoop() {
TQTimer::singleShot(0, this, SLOT(commandLoop()));
if (!m_loopTimer) {
m_loopTimer = new TQTimer();
connect(m_loopTimer, SIGNAL(timeout()), this, SLOT(commandLoop()));
}
if (m_loopTimer) m_loopTimer->start(0, TRUE);
return 0;
}

@ -62,6 +62,8 @@ class FPGASocket : public TDEKerberosServerSocket
TQString m_remoteHost;
int m_fd_tty;
TQTimer* m_loopTimer;
KSimpleConfig* m_config;
friend class FPGAServer;

Loading…
Cancel
Save