summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-06-18 16:34:04 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-06-18 16:34:04 (GMT)
commitc31ab7f87ea33b4e1de2ae28c3c9e5263de23b77 (patch)
treed849f6bf26774e08601c860801a815bdf31c5bfe /Swiften/Network/BoostConnectionServer.cpp
parented0dbffeb8a3b36965d359c8a689bdb41372e481 (diff)
parent7d0e9c3d963ffcb3f7d6d313dfa55466beb742b9 (diff)
downloadswift-c31ab7f87ea33b4e1de2ae28c3c9e5263de23b77.zip
swift-c31ab7f87ea33b4e1de2ae28c3c9e5263de23b77.tar.bz2
Merge branch 'swift-1.x'
* swift-1.x: Small tweaks to the previous patch. Added ConnectionServerFactory. Conflicts: Swiften/Network/SConscript
Diffstat (limited to 'Swiften/Network/BoostConnectionServer.cpp')
-rw-r--r--Swiften/Network/BoostConnectionServer.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/Swiften/Network/BoostConnectionServer.cpp b/Swiften/Network/BoostConnectionServer.cpp
index 9b2ed0d..eccffc6 100644
--- a/Swiften/Network/BoostConnectionServer.cpp
+++ b/Swiften/Network/BoostConnectionServer.cpp
@@ -17,13 +17,22 @@ namespace Swift {
BoostConnectionServer::BoostConnectionServer(int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(NULL) {
}
+BoostConnectionServer::BoostConnectionServer(const HostAddress &address, int port, boost::shared_ptr<boost::asio::io_service> ioService, EventLoop* eventLoop) : address_(address), port_(port), ioService_(ioService), eventLoop(eventLoop), acceptor_(NULL) {
+}
void BoostConnectionServer::start() {
try {
assert(!acceptor_);
- acceptor_ = new boost::asio::ip::tcp::acceptor(
+ if (address_.isValid()) {
+ acceptor_ = new boost::asio::ip::tcp::acceptor(
+ *ioService_,
+ boost::asio::ip::tcp::endpoint(address_.getRawAddress(), port_));
+ }
+ else {
+ acceptor_ = new boost::asio::ip::tcp::acceptor(
*ioService_,
boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), port_));
+ }
acceptNextConnection();
}
catch (const boost::system::system_error& e) {