diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2012-03-23 14:24:56 +0000 |
---|---|---|
committer | Matúš Kukan <matus.kukan@gmail.com> | 2012-07-17 16:39:52 +0200 |
commit | aebe0af1cd0291a271ec6c2763c37b829b4b8075 (patch) | |
tree | 471f15e387068291ece5ca7d2eeb1fb12c1b23a9 /tubes | |
parent | c0d0ad8818d4172c34d8ce82bab0ed582ab6ea90 (diff) |
tubes: push sent packets onto the incoming queue.
This ensures that our changes are echoed locally as well as being sent
to the peer.
Diffstat (limited to 'tubes')
-rw-r--r-- | tubes/inc/tubes/conference.hxx | 3 | ||||
-rw-r--r-- | tubes/qa/test_manager.cxx | 11 | ||||
-rw-r--r-- | tubes/source/conference.cxx | 17 |
3 files changed, 24 insertions, 7 deletions
diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx index 8a891d579a36..35812bb09cfc 100644 --- a/tubes/inc/tubes/conference.hxx +++ b/tubes/inc/tubes/conference.hxx @@ -63,13 +63,14 @@ public: /** @param rPacket non-const on purpose, see TelePacket::getData() */ - bool sendPacket( TelePacket& rPacket ) const; + bool sendPacket( TelePacket& rPacket ); /** Pop a received packet. */ TUBES_DLLPUBLIC bool popPacket( TelePacket& rPacket ); /** Queue incoming data as TelePacket */ void queue( const char* pDBusSender, const char* pPacket, int nSize ); + void queue( TelePacket &rPacket ); typedef void (*FileSentCallback)( bool aSuccess, void* pUserData); diff --git a/tubes/qa/test_manager.cxx b/tubes/qa/test_manager.cxx index a7e690fae1f6..f76353d70f00 100644 --- a/tubes/qa/test_manager.cxx +++ b/tubes/qa/test_manager.cxx @@ -279,6 +279,11 @@ void TestTeleTubes::testReceivePacket() TelePacket aPacket( "", RTL_CONSTASCII_STRINGPARAM( "from 1 to 2")); TelePacket aReceived; sal_uInt32 nReceivedPackets = 0; + /* We expect to get every packet we send pushed onto the queue to be echoed + * locally; and since we are also listening at the "other end", we expect + * to receive a copy of each packet as well. + */ + sal_uInt32 nExpectedPackets = nSentPackets * 2; bool bOk; do { @@ -291,10 +296,10 @@ void TestTeleTubes::testReceivePacket() CPPUNIT_ASSERT( aPacket == aReceived); } } while (bOk); - if (nReceivedPackets < nSentPackets) + if (nReceivedPackets < nExpectedPackets) mpManager1->iterateLoop(); - } while (nReceivedPackets < nSentPackets); - CPPUNIT_ASSERT( nReceivedPackets == nSentPackets); + } while (nReceivedPackets < nExpectedPackets); + CPPUNIT_ASSERT( nReceivedPackets == nExpectedPackets); } void TestTeleTubes::FileSent( bool success, void *user_data) diff --git a/tubes/source/conference.cxx b/tubes/source/conference.cxx index d48807d1b933..4e218b85108a 100644 --- a/tubes/source/conference.cxx +++ b/tubes/source/conference.cxx @@ -400,7 +400,7 @@ void TeleConference::finalize() } -bool TeleConference::sendPacket( TelePacket& rPacket ) const +bool TeleConference::sendPacket( TelePacket& rPacket ) { INFO_LOGGER( "TeleConference::sendPacket"); @@ -432,21 +432,32 @@ bool TeleConference::sendPacket( TelePacket& rPacket ) const bool bSent = dbus_connection_send( mpTube, pMessage, NULL); SAL_WARN_IF( !bSent, "tubes", "TeleConference::sendPacket: not sent"); + + /* FIXME: need to impose an ordering on packets. */ + queue( rPacket ); + dbus_message_unref( pMessage); return bSent; } -void TeleConference::queue( const char* pDBusSender, const char* pPacketData, int nPacketSize ) +void TeleConference::queue( TelePacket &rPacket ) { INFO_LOGGER( "TeleConference::queue"); - maPacketQueue.push( TelePacket( pDBusSender, pPacketData, nPacketSize)); + maPacketQueue.push( rPacket); getManager()->callbackOnRecieved( this); } +void TeleConference::queue( const char* pDBusSender, const char* pPacketData, int nPacketSize ) +{ + TelePacket aPacket( pDBusSender, pPacketData, nPacketSize ); + queue( aPacket ); +} + + class SendFileRequest { public: SendFileRequest( TeleConference *pSelf, |