summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/FileTransfer')
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp5
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.cpp12
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.h1
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.cpp2
-rw-r--r--Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.h1
5 files changed, 15 insertions, 6 deletions
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
index 43d3e46..3137163 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerManager.cpp
@@ -192,6 +192,10 @@ void SOCKS5BytestreamServerManager::stop() {
forwardPortRequest->stop();
forwardPortRequest.reset();
}
+ if (server) {
+ server->stop();
+ server = NULL;
+ }
if (connectionServer) {
connectionServer->stop();
connectionServer.reset();
@@ -223,6 +227,7 @@ void SOCKS5BytestreamServerManager::handleForwardPortResult(boost::optional<NATP
}
portMapping = mapping;
+ onPortForwardingSetup(mapping.is_initialized());
forwardPortRequest->stop();
forwardPortRequest.reset();
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.cpp
index 9ab097b..e3b6d34 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.cpp
@@ -15,14 +15,16 @@ namespace Swift {
SOCKS5BytestreamServerPortForwardingUser::SOCKS5BytestreamServerPortForwardingUser(SOCKS5BytestreamServerManager* s5bServerManager) : s5bServerManager_(s5bServerManager) {
// the server should be initialized, so we know what port to setup a forward for
assert(s5bServerManager->isInitialized());
- assert(!s5bServerManager_->isPortForwardingReady());
-
- s5bServerManager_->onPortForwardingSetup.connect(boost::bind(&SOCKS5BytestreamServerPortForwardingUser::handleServerManagerPortForwardingSetup, this, _1));
- s5bServerManager_->setupPortForwarding();
+ if (s5bServerManager_->isPortForwardingReady()) {
+ onSetup(!s5bServerManager_->getAssistedHostAddressPorts().empty());
+ }
+ else {
+ onPortForwardingSetupConnection_ = s5bServerManager_->onPortForwardingSetup.connect(boost::bind(&SOCKS5BytestreamServerPortForwardingUser::handleServerManagerPortForwardingSetup, this, _1));
+ s5bServerManager_->setupPortForwarding();
+ }
}
SOCKS5BytestreamServerPortForwardingUser::~SOCKS5BytestreamServerPortForwardingUser() {
- s5bServerManager_->onPortForwardingSetup.disconnect(boost::bind(&SOCKS5BytestreamServerPortForwardingUser::handleServerManagerPortForwardingSetup, this, _1));
if (s5bServerManager_->isPortForwardingReady()) {
s5bServerManager_->removePortForwarding();
}
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.h b/Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.h
index f486836..c4550d3 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.h
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerPortForwardingUser.h
@@ -26,6 +26,7 @@ class SOCKS5BytestreamServerPortForwardingUser {
private:
SOCKS5BytestreamServerManager* s5bServerManager_;
+ boost::bsignals::scoped_connection onPortForwardingSetupConnection_;
};
}
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.cpp b/Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.cpp
index bf7d4e8..b369347 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.cpp
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.cpp
@@ -14,7 +14,7 @@ namespace Swift {
SOCKS5BytestreamServerResourceUser::SOCKS5BytestreamServerResourceUser(SOCKS5BytestreamServerManager* s5bServerManager) : s5bServerManager_(s5bServerManager) {
assert(!s5bServerManager_->isInitialized());
- s5bServerManager_->onInitialized.connect(boost::bind(&SOCKS5BytestreamServerResourceUser::handleServerManagerInitialized, this, _1));
+ onInitializedConnection_ = s5bServerManager_->onInitialized.connect(boost::bind(&SOCKS5BytestreamServerResourceUser::handleServerManagerInitialized, this, _1));
s5bServerManager_->initialize();
}
diff --git a/Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.h b/Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.h
index 014689b..fa7f42c 100644
--- a/Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.h
+++ b/Swiften/FileTransfer/SOCKS5BytestreamServerResourceUser.h
@@ -26,6 +26,7 @@ class SOCKS5BytestreamServerResourceUser {
private:
SOCKS5BytestreamServerManager* s5bServerManager_;
+ boost::bsignals::scoped_connection onInitializedConnection_;
};
}