1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

HttpServer: use settings structure as an object not a pointer

This commit is contained in:
f4exb
2017-11-13 13:46:02 +01:00
parent 583712a3d5
commit cf9c7eb8bb
12 changed files with 151 additions and 82 deletions
+21 -6
View File
@@ -14,11 +14,10 @@
#include "httpsession.h"
#include "httpresponse.h"
#include "httprequest.h"
#include "httpsessionssettings.h"
namespace qtwebapp {
class HttpSessionsSettings;
/**
Stores HTTP sessions and deletes them when they have expired.
The following configuration settings are required in the config file:
@@ -39,9 +38,11 @@ class DECLSPEC HttpSessionStore : public QObject {
Q_DISABLE_COPY(HttpSessionStore)
public:
/** Constructor. */
/** Constructor with Qt settings. */
HttpSessionStore(QSettings* settings, QObject* parent=NULL);
HttpSessionStore(HttpSessionsSettings* settings, QObject* parent=NULL);
/** Constructor with settings structure. */
HttpSessionStore(const HttpSessionsSettings& settings, QObject* parent=NULL);
/** Destructor */
virtual ~HttpSessionStore();
@@ -81,15 +82,29 @@ public:
/** Delete a session */
void removeSession(HttpSession session);
/**
* Get a sessions settings copy
* @return The current sessions settings
*/
HttpSessionsSettings getListenerSettings() const { return sessionsSettings; }
/**
* Set new sessions settings data
* @param sessions settings to replace current data
*/
void setListenerSettings(const HttpSessionsSettings& settings) { sessionsSettings = settings; }
protected:
/** Storage for the sessions */
QMap<QByteArray,HttpSession> sessions;
private:
/** Configuration settings */
/** Configuration settings as Qt settings*/
QSettings* settings;
HttpSessionsSettings *sessionsSettings;
/** Configuration settings as a structure*/
HttpSessionsSettings sessionsSettings;
/** Timer to remove expired sessions */
QTimer cleanupTimer;