summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordknn <yoann.blein@free.fr>2012-07-15 13:45:23 (GMT)
committerdknn <yoann.blein@free.fr>2012-09-22 09:01:49 (GMT)
commit70e395802de55b1d2eb9f92ad86349cd2d0d0575 (patch)
tree8759cc27b5d8e0a9984bab0beb6802fab769ae8a
parentdd1c425caa5badf2d0b53271b7734f5be57d4003 (diff)
downloadswift-contrib-70e395802de55b1d2eb9f92ad86349cd2d0d0575.zip
swift-contrib-70e395802de55b1d2eb9f92ad86349cd2d0d0575.tar.bz2
Add signal disconnects
-rw-r--r--Swiften/Examples/SConscript1
-rw-r--r--Swiften/ScreenSharing/OutgoingScreenSharing.cpp8
-rw-r--r--Swiften/ScreenSharing/RTPSession.cpp15
-rw-r--r--Swiften/ScreenSharing/ScreenSharing.cpp3
4 files changed, 9 insertions, 18 deletions
diff --git a/Swiften/Examples/SConscript b/Swiften/Examples/SConscript
index fb568fc..11238ff 100644
--- a/Swiften/Examples/SConscript
+++ b/Swiften/Examples/SConscript
@@ -10,4 +10,5 @@ SConscript(dirs = [
"NetworkTool",
"ParserTester",
"BenchTool",
+ "ScreenSharing",
])
diff --git a/Swiften/ScreenSharing/OutgoingScreenSharing.cpp b/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
index 77226c5..ec0a39c 100644
--- a/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
+++ b/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
@@ -28,11 +28,12 @@ OutgoingScreenSharing::OutgoingScreenSharing(boost::shared_ptr<JingleSession> se
timerFactory(timerFactory), contentID(JingleContentID(idGenerator.generateID(), JingleContentPayload::InitiatorCreator)),
canceled(false), sessionAccepted(false), socketConnected(false), encoder(0), packetizer(0)
{
- session->onSessionAcceptReceived.connect(boost::bind(&OutgoingScreenSharing::handleSessionAcceptReceived, this, _1, _2, _3));
+ jingleSession->onSessionAcceptReceived.connect(boost::bind(&OutgoingScreenSharing::handleSessionAcceptReceived, this, _1, _2, _3));
}
OutgoingScreenSharing::~OutgoingScreenSharing()
{
+ jingleSession->onSessionAcceptReceived.disconnect(boost::bind(&OutgoingScreenSharing::handleSessionAcceptReceived, this, _1, _2, _3));
delete rtpSession;
delete encoder;
delete packetizer;
@@ -64,7 +65,6 @@ void OutgoingScreenSharing::start(unsigned int width, unsigned int height)
jingleSession->sendInitiate(contentID, desc, transport);
onStateChange(ScreenSharing::WaitingForAccept);
- serverSocket->onConnected.connect(boost::bind(&OutgoingScreenSharing::handleSocketConnected, this));
serverSocket->connectToFirstIncoming();
}
@@ -79,6 +79,8 @@ void OutgoingScreenSharing::handleSocketConnected()
return;
SWIFT_LOG(debug) << "Screen sharing: UDP socket connected" << std::endl;
+ serverSocket->onConnected.disconnect(boost::bind(&OutgoingScreenSharing::handleSocketConnected, this));
+
socketConnected = true;
if (sessionAccepted)
startRTPSession();
@@ -107,6 +109,8 @@ void OutgoingScreenSharing::handleConnectionFailed()
{
SWIFT_LOG(debug) << "Screen sharing: unable to connect" << std::endl;
+ connectionTimer->onTick.disconnect(boost::bind(&OutgoingScreenSharing::handleConnectionFailed, this));
+
jingleSession->sendTerminate(JinglePayload::Reason::ConnectivityError);
canceled = true;
diff --git a/Swiften/ScreenSharing/RTPSession.cpp b/Swiften/ScreenSharing/RTPSession.cpp
deleted file mode 100644
index 3a22326..0000000
--- a/Swiften/ScreenSharing/RTPSession.cpp
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright (c) 2012 Yoann Blein
- * Licensed under the simplified BSD license.
- * See Documentation/Licenses/BSD-simplified.txt for more information.
- */
-
-#include <Swiften/ScreenSharing/RTPSession.h>
-
-namespace Swift {
-
-RTPSession::~RTPSession()
-{
-}
-
-}
diff --git a/Swiften/ScreenSharing/ScreenSharing.cpp b/Swiften/ScreenSharing/ScreenSharing.cpp
index eede971..be3c8ab 100644
--- a/Swiften/ScreenSharing/ScreenSharing.cpp
+++ b/Swiften/ScreenSharing/ScreenSharing.cpp
@@ -21,11 +21,12 @@ namespace Swift {
ScreenSharing::ScreenSharing(boost::shared_ptr<JingleSession> session, UDPSocketFactory* udpSocketFactory)
: rtpSession(0), jingleSession(session), udpSocketFactory(udpSocketFactory)
{
- session->onSessionTerminateReceived.connect(boost::bind(&ScreenSharing::handleSessionTerminateReceived, this, _1));
+ jingleSession->onSessionTerminateReceived.connect(boost::bind(&ScreenSharing::handleSessionTerminateReceived, this, _1));
}
ScreenSharing::~ScreenSharing()
{
+ jingleSession->onSessionTerminateReceived.disconnect(boost::bind(&ScreenSharing::handleSessionTerminateReceived, this, _1));
}
void ScreenSharing::stop()