summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xclient/Config.cpp4
-rw-r--r--client/Config.h28
-rw-r--r--client/Dialog.cpp2
-rw-r--r--client/Dialog.h7
-rw-r--r--client/SslClient.cpp11
-rw-r--r--client/SslClient.h1
-rw-r--r--client/UpdatedConfig.h15
7 files changed, 55 insertions, 13 deletions
diff --git a/client/Config.cpp b/client/Config.cpp
index 79a4aae..e6174c1 100755
--- a/client/Config.cpp
+++ b/client/Config.cpp
@@ -266,7 +266,7 @@ void Config::ParseFirewalls(string data)
/**
- * @todo remove Config::ReadGenericProxy method
+ * @deprecated left for testing purposes, will be removed
*/
void Config::ReadGenericProxy()
{
@@ -295,7 +295,7 @@ void Config::ReadGenericProxy()
}
/**
- * @todo remove Config::ReadStaticProxy method
+ * @deprecated left for testing purposes, will be removed
*/
void Config::ReadStaticProxy()
{
diff --git a/client/Config.h b/client/Config.h
index 8640d1e..26ee56c 100644
--- a/client/Config.h
+++ b/client/Config.h
@@ -10,11 +10,8 @@ using std::vector;
using std::string;
/**
- * @brief Singleton class that represents client configuration<br/>
- * At the first time this object is accessed config.cfg is read to
- * determine initial settings, server addresses, etc.<br/>
- * Then retries is made to connect to server and acqire actual config,
- * firewall list, etc.
+ * @brief represents client configuration<br/>
+ * When vreated config.cfg is read to determine basic settings, server addresses, etc.<br/>
*/
class Config
{
@@ -72,7 +69,7 @@ public:
/**
* @brief Update client configuration
- * @todo update config periodically on timer events
+ * @deprecated config is updated periodically on timer events now
*/
void AcquireConfig();
@@ -197,9 +194,28 @@ protected:
*/
Config();
+ /**
+ * @brief parse client configuration
+ * @param data string containing configuration parameters
+ */
void ParseConfig(string data);
+
+ /**
+ * @brief parse list of generic proxies
+ * @param data string containing list of ProxyEntryGeneric records
+ */
void ParseGenericProxies(string data);
+
+ /**
+ * @brief parse list of static proxies
+ * @param data string containing list of ProxyEntryStatic records
+ */
void ParseStaticPorxies(string data);
+
+ /**
+ * @brief parse firewall configuration
+ * @param data string containing list of FirewallEntry records
+ */
void ParseFirewalls(string data);
unsigned updateInterval;
diff --git a/client/Dialog.cpp b/client/Dialog.cpp
index 3a7f473..e9d3883 100644
--- a/client/Dialog.cpp
+++ b/client/Dialog.cpp
@@ -11,9 +11,7 @@ using namespace std;
ProxyDialog::ProxyDialog(QWidget *parent): QDialog(parent)
{
- //WIPE it out!!! COnfig shoud be reread by timer event!
UpdatedConfig *cfg = UpdatedConfig::CurrentConfig();
- cfg->AcquireConfig();
/* generic proxy panel */
topLabel = new QLabel(QString::fromLocal8Bit(cfg->TopPanelText.c_str()));
diff --git a/client/Dialog.h b/client/Dialog.h
index d7d7b5e..e777cf9 100644
--- a/client/Dialog.h
+++ b/client/Dialog.h
@@ -12,10 +12,17 @@ class QLabel;
class ProxyEntryGeneric;
class ProxyEntryStatic;
+/**
+ * @brief Dialog window to choose proxy configuration
+ */
class ProxyDialog: public QDialog
{
Q_OBJECT
public:
+ /**
+ * @brief Create an instance of dialog window
+ * @param parent parent window
+ */
ProxyDialog(QWidget *parent = 0);
private slots:
diff --git a/client/SslClient.cpp b/client/SslClient.cpp
index 6d13369..c04667b 100644
--- a/client/SslClient.cpp
+++ b/client/SslClient.cpp
@@ -78,7 +78,7 @@ void SslClient::SendRequest(RequestType type)
{
Logger::Trace("Already connected to %s:%u\n", server.toLocal8Bit().data(), port);
}
-
+
unsigned char rcode = 0x00;
switch (type)
{
@@ -109,6 +109,10 @@ void SslClient::Connected()
void SslClient::Disconnected()
{
Logger::Info("Disconnected from server %s\n", server.toStdString().c_str());
+
+#ifdef DEBUG
+ SendRequest(StaticProxyList);
+#endif
}
void SslClient::DataRecieved()
@@ -154,6 +158,11 @@ void SslClient::DataRecieved()
data.remove(0, 3);
data.remove(length-1, 3);
+#ifdef DEBUG
+ Logger::Debug("Disconnecting from server\n");
+ sslSocket.disconnectFromHost();
+#endif
+
emit ReplyRecieved(type, data);
}
diff --git a/client/SslClient.h b/client/SslClient.h
index 4c91da3..ecf4edd 100644
--- a/client/SslClient.h
+++ b/client/SslClient.h
@@ -86,6 +86,7 @@ signals:
/**
* @brief This ssignal is emited when data request can't be completed
+ * @todo emit this signal on all SSL errors too
*/
void ConnectionError();
private slots:
diff --git a/client/UpdatedConfig.h b/client/UpdatedConfig.h
index 669c126..041fc45 100644
--- a/client/UpdatedConfig.h
+++ b/client/UpdatedConfig.h
@@ -8,6 +8,13 @@
class QTimer;
+
+/**
+ * @brief singleton class that can update it's configuration<br/>
+ * -# ServerEntry is read from servers list
+ * -# Trying to connect every Config::ServerEntry::retryTimeout
+ * -# When total time for all retries exceeds Config::ServerEntry::timeout go to the next ServerEntry
+ */
class UpdatedConfig: public QObject, public Config
{
Q_OBJECT
@@ -19,6 +26,10 @@ public:
*/
static UpdatedConfig *CurrentConfig();
private:
+ /**
+ * @brief creates an instance and tries to connect to servers from config.cfg<br/>
+ * one by one until working server is found or no other ServerEntry records left
+ */
UpdatedConfig();
/**
@@ -27,7 +38,7 @@ private:
static UpdatedConfig *self;
/**
- * @brief SslCLient instance that connects to server and retrieves config
+ * @brief SslClient instance that connects to server and retrieves config
*/
SslClient *client;
@@ -59,7 +70,7 @@ private:
/**
* @brief value indicating which config parts are already updated<br/>
- * to check if some part is updated just apply && to this<br/>
+ * to check if some part is updated just apply & to this<br/>
* value and any of SslClient::RequestType values
*/
unsigned char updateStatus;