summaryrefslogtreecommitdiff
path: root/tubes
diff options
context:
space:
mode:
authorMatúš Kukan <matus.kukan@gmail.com>2012-08-04 22:40:40 +0200
committerMatúš Kukan <matus.kukan@gmail.com>2012-08-04 22:51:37 +0200
commitc3c9ae052bd062c9057fd08675e0593d00ccd601 (patch)
treeb31075b995fcb6da896ebe20ee2f6ee88563adc8 /tubes
parentb3da63d28fedeee9306fb2c44ffd85271408fa7d (diff)
tubes: do not queue incoming packets
Change-Id: Ida0f3b9ce7cebdb0517457900d2b0b2377e6c8ab
Diffstat (limited to 'tubes')
-rw-r--r--tubes/inc/tubes/conference.hxx9
-rw-r--r--tubes/qa/test_manager.cxx17
-rw-r--r--tubes/source/conference.cxx36
-rw-r--r--tubes/source/manager.cxx3
4 files changed, 15 insertions, 50 deletions
diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx
index ad5ae1e15758..9222f0f20471 100644
--- a/tubes/inc/tubes/conference.hxx
+++ b/tubes/inc/tubes/conference.hxx
@@ -59,17 +59,14 @@ public:
TUBES_DLLPUBLIC bool sendPacket( const OString& rPacket );
- /** Pop a received packet. */
- bool popPacket( OString& rPacket );
-
void invite( TpContact *pContact );
typedef void (*FileSentCallback)( bool aSuccess, void* pUserData);
TUBES_DLLPUBLIC void sendFile( TpContact* pContact, rtl::OUString &localUri, FileSentCallback pCallback, void* pUserData);
const OString& getUuid() const { return msUuid; }
- Collaboration* getCollaboration() const { return mpCollaboration; }
- void setCollaboration( Collaboration* pCollaboration ) { mpCollaboration = pCollaboration; }
+ Collaboration* getCollaboration() const;
+ void setCollaboration( Collaboration* pCollaboration );
// --- following only to be called only by manager's callbacks ---
// TODO: make friends instead
@@ -82,8 +79,6 @@ public:
void setTubeOfferedHandlerInvoked( bool b );
bool isTubeOfferedHandlerInvoked() const;
bool isMaster() const;
- /** Queue incoming data as OString */
- void queue( const OString& rPacket );
void setUuid( const OString& rUuid ) { msUuid = rUuid; }
private:
diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx
index 89afd113614b..850d5d5fab92 100644
--- a/tubes/qa/test_manager.cxx
+++ b/tubes/qa/test_manager.cxx
@@ -221,22 +221,7 @@ void TestTeleTubes::testReceivePacket()
* and extracting UUID from the name.
*/
- sal_uInt32 nReceivedPackets = 0;
- /* We expect to get every packet we send pushed
- * onto the queue to be echoed locally.
- */
- bool bOk;
- do
- {
- OString aReceived;
- bOk = mpConference1->popPacket( aReceived );
- if (bOk)
- {
- ++nReceivedPackets;
- CPPUNIT_ASSERT( "from 1 to 2" == aReceived );
- }
- } while (bOk);
- CPPUNIT_ASSERT( nReceivedPackets == mnSentPackets );
+ // TODO implement me
}
void TestTeleTubes::FileSent( bool success, void * )
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()