summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordknn <yoann.blein@free.fr>2012-07-16 12:00:56 (GMT)
committerdknn <yoann.blein@free.fr>2012-09-22 09:01:49 (GMT)
commit292967c02ffc2ff0b53df526af2965a03916290c (patch)
tree6712ee7c70d4a68af1cd7e46f6929f4bfce2f27d /Swiften/ScreenSharing/OutgoingScreenSharing.cpp
parent05ef8661b2f42cc5b889f3900b459d8a49a24db3 (diff)
downloadswift-contrib-292967c02ffc2ff0b53df526af2965a03916290c.zip
swift-contrib-292967c02ffc2ff0b53df526af2965a03916290c.tar.bz2
Better handling of udp bind errors
Diffstat (limited to 'Swiften/ScreenSharing/OutgoingScreenSharing.cpp')
-rw-r--r--Swiften/ScreenSharing/OutgoingScreenSharing.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/Swiften/ScreenSharing/OutgoingScreenSharing.cpp b/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
index 906bd68..005e204 100644
--- a/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
+++ b/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
@@ -50,8 +50,6 @@ void OutgoingScreenSharing::cancel()
void OutgoingScreenSharing::start(unsigned int width, unsigned int height)
{
//onStateChange(ScreenSharing::WaitingForStart);
- SWIFT_LOG(debug) << "Screen sharing: start" << std::endl;
-
this->width = width;
this->height = height;
@@ -60,13 +58,17 @@ void OutgoingScreenSharing::start(unsigned int width, unsigned int height)
desc->addPayloadType(payloadTypeUsed);
JingleRawUDPTransportPayload::ref transport = boost::make_shared<JingleRawUDPTransportPayload>();
- addBestCandidate(transport);
-
- jingleSession->sendInitiate(contentID, desc, transport);
- onStateChange(ScreenSharing::WaitingForAccept);
-
- serverSocket->onConnected.connect(boost::bind(&OutgoingScreenSharing::handleSocketConnected, this));
- serverSocket->connectToFirstIncoming();
+ if (addBestCandidate(transport)) {
+ SWIFT_LOG(debug) << "Screen sharing: start" << std::endl;
+ jingleSession->sendInitiate(contentID, desc, transport);
+ serverSocket->onConnected.connect(boost::bind(&OutgoingScreenSharing::handleSocketConnected, this));
+ serverSocket->connectToFirstIncoming();
+ onStateChange(ScreenSharing::WaitingForAccept);
+ } else {
+ SWIFT_LOG(error) << "Screen sharing: Unable to listening on any interface" << std::endl;
+ onStateChange(ScreenSharing::Failed);
+ onFinished();
+ }
}
void OutgoingScreenSharing::addImage(const Image &image)