summaryrefslogtreecommitdiffstats
path: root/servers/auth_server_lin
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-03-15 02:10:40 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-03-15 02:10:40 -0500
commit128d497c25bf40e1fd136a7e980125e01cc2beed (patch)
tree04e42b5ffab65fd2ff98812c46e507fcf8312667 /servers/auth_server_lin
parent400d0abcff5986c764f4a25bec29c2af57286ee1 (diff)
downloadulab-128d497c25bf40e1fd136a7e980125e01cc2beed.tar.gz
ulab-128d497c25bf40e1fd136a7e980125e01cc2beed.zip
Add method to mark ulab servers as online or offline
Diffstat (limited to 'servers/auth_server_lin')
-rw-r--r--servers/auth_server_lin/src/auth_conn.cpp23
-rw-r--r--servers/auth_server_lin/src/auth_conn.h1
2 files changed, 21 insertions, 3 deletions
diff --git a/servers/auth_server_lin/src/auth_conn.cpp b/servers/auth_server_lin/src/auth_conn.cpp
index d9794ad..72e8240 100644
--- a/servers/auth_server_lin/src/auth_conn.cpp
+++ b/servers/auth_server_lin/src/auth_conn.cpp
@@ -50,7 +50,7 @@ struct exit_exception {
*/
AuthSocket::AuthSocket(int sock, int serverID, TQObject *parent, const char *name) :
TDEKerberosServerSocket(parent, name), m_criticalSection(0), m_stationID(-1), m_bound(false), m_serviceID(0), m_serverID(serverID), m_terminationStamp(0), m_servActive(false), m_servState(0), m_servClientSocket(NULL), m_servClientTimeout(NULL), m_loopTimer(NULL), m_pollTimer(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), m_databaseStatisticsCursor(NULL)
+ m_databaseServicesCursor(NULL), m_databaseServiceTypesCursor(NULL), m_databasePermissionsCursor(NULL), m_databaseActivityCursor(NULL), m_databaseStatisticsCursor(NULL), m_databaseStatusCursor(NULL)
{
// Initialize timers
@@ -107,6 +107,9 @@ AuthSocket::~AuthSocket() {
if (m_databaseStatisticsCursor) {
delete m_databaseStatisticsCursor;
}
+ if (m_databaseStatusCursor) {
+ delete m_databaseStatusCursor;
+ }
if (m_servClientSocket) {
delete m_servClientSocket;
}
@@ -519,8 +522,21 @@ void AuthSocket::commandLoop() {
if (activeID < 0) {
for (StationList::Iterator it(m_slist.begin()); it != m_slist.end(); ++it) {
if ((*it).services == st.services) {
- m_stationID = (*it).id;
- break;
+ // Verify that all services provided by this candidate workspace are online before allocating the workspace to a user
+ bool online = true;
+ m_databaseServicesCursor->select(TQString("station=%1").arg((*it).id));
+ while (m_databaseServicesCursor->next()) {
+ m_databaseStatusCursor->select(TQString("serviceid=%1").arg(m_databaseServicesCursor->value("hostname").toString()));
+ if (m_databaseStatusCursor->next()) {
+ if (m_databaseStatusCursor->value("online").toInt() == 0) {
+ online = false;
+ }
+ }
+ }
+ if (online) {
+ m_stationID = (*it).id;
+ break;
+ }
}
}
@@ -713,6 +729,7 @@ int AuthSocket::connectToDatabase() {
m_databasePermissionsCursor = new TQSqlCursor("permissions", TRUE, m_database);
m_databaseActivityCursor = new TQSqlCursor("activity", TRUE, m_database);
m_databaseStatisticsCursor = new TQSqlCursor("statistics", TRUE, m_database);
+ m_databaseStatusCursor = new TQSqlCursor("status", TRUE, m_database);
return 0;
}
diff --git a/servers/auth_server_lin/src/auth_conn.h b/servers/auth_server_lin/src/auth_conn.h
index b4f8b23..612b671 100644
--- a/servers/auth_server_lin/src/auth_conn.h
+++ b/servers/auth_server_lin/src/auth_conn.h
@@ -95,6 +95,7 @@ class AuthSocket : public TDEKerberosServerSocket
TQSqlCursor* m_databasePermissionsCursor;
TQSqlCursor* m_databaseActivityCursor;
TQSqlCursor* m_databaseStatisticsCursor;
+ TQSqlCursor* m_databaseStatusCursor;
StationList m_slist;