]> git.stg.codes - stg.git/blobdiff - projects/rlm_stg/iface.cpp
Implemeted reconnect in rlm_stg when the connection is lost.
[stg.git] / projects / rlm_stg / iface.cpp
index 0cb30b932090e7a0721e17212009455d81bdd539..7394e288bd9be3f79cd5d2d6be563a3a708ec8d2 100644 (file)
@@ -89,6 +89,12 @@ STG_RESULT stgRequest(STG_CLIENT::TYPE type, const char* userName, const char* p
         return emptyResult();
     }
     try {
+        if (!client->connected())
+        {
+            if (!STG_CLIENT::reconnect())
+                return emptyResult();
+            client = STG_CLIENT::get();
+        }
         response.done = false;
         client->request(type, toString(userName), toString(password), fromSTGPairs(pairs));
         pthread_mutex_lock(&response.mutex);