diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-12 17:41:18 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-12 17:41:18 (GMT) |
commit | eb1338be843c53aa02fac0d38455aada3f89db0b (patch) | |
tree | c896aef2d57275b17d9fb1c6c14c59157e0f93ce | |
parent | 2a64272ce320b4f542f2c381fe061a58bc1835fc (diff) | |
download | swift-eb1338be843c53aa02fac0d38455aada3f89db0b.zip swift-eb1338be843c53aa02fac0d38455aada3f89db0b.tar.bz2 |
Extended the toy server a bit more.
-rw-r--r-- | Limber/main.cpp | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Limber/main.cpp b/Limber/main.cpp index e68e03f..8378c52 100644 --- a/Limber/main.cpp +++ b/Limber/main.cpp @@ -14,12 +14,20 @@ #include "Swiften/Network/IncomingConnection.h" #include "Swiften/Network/ConnectionServer.h" #include "Swiften/Network/BoostIOServiceThread.h" +#include "Swiften/Parser/PayloadParsers/FullPayloadParserFactoryCollection.h" +#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h" using namespace Swift; class ServerFromClientSession { public: - ServerFromClientSession(boost::shared_ptr<IncomingConnection> connection) : connection_(connection) { + ServerFromClientSession( + boost::shared_ptr<IncomingConnection> connection, + PayloadParserFactoryCollection* payloadParserFactories, + PayloadSerializerCollection* payloadSerializers) : + connection_(connection), + payloadParserFactories_(payloadParserFactories), + payloadSerializers_(payloadSerializers) { } void start() { @@ -31,6 +39,8 @@ class ServerFromClientSession { private: boost::shared_ptr<IncomingConnection> connection_; + PayloadParserFactoryCollection* payloadParserFactories_; + PayloadSerializerCollection* payloadSerializers_; }; // A reference-counted non-modifiable buffer class. @@ -121,7 +131,7 @@ class Server { private: void handleNewConnection(boost::shared_ptr<IncomingConnection> c) { - ServerFromClientSession* session = new ServerFromClientSession(c); + ServerFromClientSession* session = new ServerFromClientSession(c, &payloadParserFactories_, &payloadSerializers_); serverFromClientSessions_.push_back(session); session->onSessionFinished.connect(boost::bind(&Server::handleSessionFinished, this, session)); session->start(); @@ -136,6 +146,8 @@ class Server { BoostIOServiceThread boostIOServiceThread_; BoostConnectionServer* serverFromClientConnectionServer_; std::vector<ServerFromClientSession*> serverFromClientSessions_; + FullPayloadParserFactoryCollection payloadParserFactories_; + FullPayloadSerializerCollection payloadSerializers_; }; int main() { |