aboutsummaryrefslogtreecommitdiff
path: root/backends/networking/sdl_net/localwebserver.h
diff options
context:
space:
mode:
authorAlexander Tkachev2016-06-16 15:19:13 +0600
committerAlexander Tkachev2016-08-24 16:07:55 +0600
commit5ac3adbd4fbf40c22fccab6ce8bf8dcab8f98eff (patch)
tree3b376dc1594ea7f4cddfaeedc6e7cacdc611021c /backends/networking/sdl_net/localwebserver.h
parent733d998e6a005af78b308817ea7326d1f5192069 (diff)
downloadscummvm-rg350-5ac3adbd4fbf40c22fccab6ce8bf8dcab8f98eff.tar.gz
scummvm-rg350-5ac3adbd4fbf40c22fccab6ce8bf8dcab8f98eff.tar.bz2
scummvm-rg350-5ac3adbd4fbf40c22fccab6ce8bf8dcab8f98eff.zip
CLOUD: Add IndexPageHandler
This commit also adds LocalWebserver's stopOnIdle(). That means server is not stopped immediately, but only when all clients are served.
Diffstat (limited to 'backends/networking/sdl_net/localwebserver.h')
-rw-r--r--backends/networking/sdl_net/localwebserver.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/backends/networking/sdl_net/localwebserver.h b/backends/networking/sdl_net/localwebserver.h
index bda0bfd7c1..2ad83f7b7a 100644
--- a/backends/networking/sdl_net/localwebserver.h
+++ b/backends/networking/sdl_net/localwebserver.h
@@ -24,6 +24,7 @@
#define BACKENDS_NETWORKING_SDL_NET_LOCALWEBSERVER_H
#include "backends/networking/sdl_net/client.h"
+#include "backends/networking/sdl_net/indexpagehandler.h"
#include "common/callback.h"
#include "common/hash-str.h"
#include "common/singleton.h"
@@ -48,23 +49,29 @@ class LocalWebserver : public Common::Singleton<LocalWebserver> {
TCPsocket _serverSocket;
Client _client[MAX_CONNECTIONS];
int _clients;
- bool _timerStarted;
+ bool _timerStarted, _stopOnIdle;
Common::HashMap<Common::String, ClientHandler> _pathHandlers;
+ IndexPageHandler _indexPageHandler;
void startTimer(int interval = TIMER_INTERVAL);
void stopTimer();
void handle();
void handleClient(uint32 i);
void acceptClient();
- void setClientGetHandler(Client &client, Common::String response, long code = 200);
-
+
public:
LocalWebserver();
virtual ~LocalWebserver();
void start();
void stop();
+ void stopOnIdle();
void addPathHandler(Common::String path, ClientHandler handler);
+ void removePathHandler(Common::String path);
+
+ IndexPageHandler &indexPageHandler();
+
+ static void setClientGetHandler(Client &client, Common::String response, long code = 200);
};
/** Shortcut for accessing the local webserver. */