diff options
author | Matúš Kukan <matus.kukan@gmail.com> | 2012-08-04 22:40:40 +0200 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2012-08-04 22:51:37 +0200 |
commit | c3c9ae052bd062c9057fd08675e0593d00ccd601 (patch) | |
tree | b31075b995fcb6da896ebe20ee2f6ee88563adc8 /tubes/source | |
parent | b3da63d28fedeee9306fb2c44ffd85271408fa7d (diff) |
tubes: do not queue incoming packets
Change-Id: Ida0f3b9ce7cebdb0517457900d2b0b2377e6c8ab
Diffstat (limited to 'tubes/source')
-rw-r--r-- | tubes/source/conference.cxx | 36 | ||||
-rw-r--r-- | tubes/source/manager.cxx | 3 |
2 files changed, 12 insertions, 27 deletions
diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx index 4eaaf8cd8d8e..88109df68429 100644 --- a/tubes/source/conference.cxx +++ b/tubes/source/conference.cxx @@ -34,7 +34,6 @@ #include <tubes/manager.hxx> #include <telepathy-glib/telepathy-glib.h> -#include <queue> #if defined SAL_LOG_INFO namespace @@ -65,11 +64,8 @@ struct InfoLogger class TeleConferenceImpl { - typedef ::std::queue<OString> TelePacketQueue; - public: guint maObjectRegistrationId; - TelePacketQueue maPacketQueue; GDBusConnection* mpTube; bool mbTubeOfferedHandlerInvoked : 1; @@ -129,7 +125,8 @@ static void TeleConference_MethodCallHandler( SAL_INFO( "tubes", "TeleConference_MethodCallHandler: received packet from sender " << (pSender ? pSender : "(null)") << " with size " << nPacketSize); OString aPacket( pPacketData, nPacketSize ); - pConference->queue( aPacket ); + if (pConference->getCollaboration()) + pConference->getCollaboration()->PacketReceived( aPacket ); // Master needs to send the packet back to impose ordering, // so the slave can execute his command. if (pConference->isMaster()) @@ -447,8 +444,8 @@ bool TeleConference::sendPacket( const OString& rPacket ) -1, NULL, NULL, NULL); // If we started the session, we can execute commands immediately. - if (mbMaster) - queue( rPacket ); + if (mbMaster && mpCollaboration) + mpCollaboration->PacketReceived( rPacket ); return true; } @@ -458,16 +455,15 @@ bool TeleConference::isMaster() const return mbMaster; } -void TeleConference::queue( const OString &rPacket ) +Collaboration* TeleConference::getCollaboration() const { - INFO_LOGGER( "TeleConference::queue"); - - pImpl->maPacketQueue.push( rPacket); - - if (mpCollaboration) - mpCollaboration->PacketReceived( rPacket ); + return mpCollaboration; } +void TeleConference::setCollaboration( Collaboration* pCollaboration ) +{ + mpCollaboration = pCollaboration; +} void TeleConference::invite( TpContact *pContact ) { @@ -559,16 +555,4 @@ void TeleConference::sendFile( TpContact* pContact, rtl::OUString &localUri, Fil TeleConference_FTReady, pReq); } - -bool TeleConference::popPacket( OString& rPacket ) -{ - INFO_LOGGER( "TeleConference::popPacket"); - - if (pImpl->maPacketQueue.empty()) - return false; - rPacket = pImpl->maPacketQueue.front(); - pImpl->maPacketQueue.pop(); - return true; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx index fd00cd05191f..f3714978191d 100644 --- a/tubes/source/manager.cxx +++ b/tubes/source/manager.cxx @@ -236,7 +236,8 @@ void TeleManager::broadcastPacket( const OString& rPacket ) INFO_LOGGER_F( "TeleManager::broadcastPacket" ); for (TeleManagerImpl::DemoConferences::iterator it = pImpl->maDemoConferences.begin(); it != pImpl->maDemoConferences.end(); ++it) - (*it)->queue( rPacket ); + if ((*it)->getCollaboration()) + (*it)->getCollaboration()->PacketReceived( rPacket ); } bool TeleManager::hasWaitingConference() |