summaryrefslogtreecommitdiffstats
path: root/Limber
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-12 13:37:21 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-12 13:37:21 (GMT)
commit9d47ed3d783da724c653a17619df904fa7986be7 (patch)
tree64cfa4710a6eb41895b5f9e8bf41eb11250e3912 /Limber
parent599bff3dfc47572b355c38562a9ceeb2b9f87268 (diff)
downloadswift-9d47ed3d783da724c653a17619df904fa7986be7.zip
swift-9d47ed3d783da724c653a17619df904fa7986be7.tar.bz2
Created IncomingConnection & ConnectionServer.
Diffstat (limited to 'Limber')
-rw-r--r--Limber/main.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Limber/main.cpp b/Limber/main.cpp
index bc061e5..0893fc8 100644
--- a/Limber/main.cpp
+++ b/Limber/main.cpp
@@ -11,6 +11,8 @@
#include "Swiften/Base/ByteArray.h"
#include "Swiften/EventLoop/MainEventLoop.h"
#include "Swiften/EventLoop/SimpleEventLoop.h"
+#include "Swiften/Network/IncomingConnection.h"
+#include "Swiften/Network/ConnectionServer.h"
using namespace Swift;
@@ -33,7 +35,7 @@ class SharedBuffer {
boost::asio::const_buffer buffer_;
};
-class IncomingBoostConnection : public boost::enable_shared_from_this<IncomingBoostConnection> {
+class IncomingBoostConnection : public IncomingConnection, public boost::enable_shared_from_this<IncomingBoostConnection> {
public:
typedef boost::shared_ptr<IncomingBoostConnection> pointer;
@@ -64,7 +66,6 @@ class IncomingBoostConnection : public boost::enable_shared_from_this<IncomingBo
}
boost::asio::ip::tcp::socket socket_;
- std::string message_;
};
class BoostIOServiceThread {
@@ -92,14 +93,12 @@ class BoostIOServiceThread {
boost::thread thread_;
};
-class BoostConnectionServer {
+class BoostConnectionServer : public ConnectionServer {
public:
BoostConnectionServer(int port, boost::asio::io_service& ioService) : acceptor_(ioService, boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port)) {
acceptNextConnection();
}
- boost::signal<void (IncomingBoostConnection::pointer)> onNewConnection;
-
private:
// Called from Asio thread
void acceptNextConnection() {
@@ -119,7 +118,7 @@ class BoostConnectionServer {
boost::asio::ip::tcp::acceptor acceptor_;
};
-void doSomething(IncomingBoostConnection::pointer c) {
+void doSomething(boost::shared_ptr<IncomingConnection> c) {
c->write("Hello\n");
}