diff options
| -rw-r--r-- | servers/auth_server_lin/src/auth_conn.cpp | 20 | ||||
| -rw-r--r-- | servers/auth_server_lin/src/auth_conn.h | 2 | ||||
| -rw-r--r-- | servers/gpib_server_lin/src/gpib_conn.cpp | 10 | 
3 files changed, 23 insertions, 9 deletions
| diff --git a/servers/auth_server_lin/src/auth_conn.cpp b/servers/auth_server_lin/src/auth_conn.cpp index cac5ba9..f2549d3 100644 --- a/servers/auth_server_lin/src/auth_conn.cpp +++ b/servers/auth_server_lin/src/auth_conn.cpp @@ -575,6 +575,11 @@ AuthServer::AuthServer(TQObject* parent) :  }  AuthServer::~AuthServer() { +	if (m_sqlPingTimer) { +		m_sqlPingTimer->stop(); +		delete m_sqlPingTimer; +		m_sqlPingTimer = NULL; +	}  	if (m_database) {  		TQSqlDatabase::removeDatabase(m_database);  		m_database = NULL; @@ -639,9 +644,24 @@ int AuthServer::connectToDatabase() {  		return -1;  	} +	// FIXME +	// We currently have no way to handle something as simple as the database server going offline! + +	// Start database ping process +	m_sqlPingTimer = new TQTimer(); +	connect(m_sqlPingTimer, SIGNAL(timeout()), this, SLOT(pingSQLServer())); +	m_sqlPingTimer->start(60*1000); +  	return 0;  } +void AuthServer::pingSQLServer() { +	// FIXME +	// We might as well gather statistics here... +	TQSqlQuery query; +	query.exec("SELECT * FROM activity"); +} +  void AuthServer::newConnection(int socket) {  	AuthSocket *s = new AuthSocket(socket, this);  	s->m_remoteHost = s->peerAddress().toString(); diff --git a/servers/auth_server_lin/src/auth_conn.h b/servers/auth_server_lin/src/auth_conn.h index 8c75bfa..61fc626 100644 --- a/servers/auth_server_lin/src/auth_conn.h +++ b/servers/auth_server_lin/src/auth_conn.h @@ -104,6 +104,7 @@ class AuthServer : public TQServerSocket  	private slots:  		int connectToDatabase(); +		void pingSQLServer();  	signals:  		void newConnect(AuthSocket*); @@ -111,6 +112,7 @@ class AuthServer : public TQServerSocket  	private:  		KSimpleConfig* m_config;  		TQSqlDatabase* m_database; +		TQTimer* m_sqlPingTimer;  		friend class AuthSocket; diff --git a/servers/gpib_server_lin/src/gpib_conn.cpp b/servers/gpib_server_lin/src/gpib_conn.cpp index d27c049..c0d43ca 100644 --- a/servers/gpib_server_lin/src/gpib_conn.cpp +++ b/servers/gpib_server_lin/src/gpib_conn.cpp @@ -807,21 +807,13 @@ void GPIBSocket::commandLoop() {  							m_servClientTimeout->start(NETWORK_COMM_TIMEOUT_MS, TRUE);  							transferred_data = true; -							m_commandLoopState = 2; +							m_commandLoopState = 1;  						}  						clearFrameTail();  					}  				}  			} -			else if (m_commandLoopState == 2) { -				if (canReadLine()) { -					processPendingData(); -				} -				if (canReadFrame()) { -					// -				} -			}  		}  		m_criticalSection--;  		if (transferred_data) { | 
