[Libreoffice-commits] .: Branch 'feature/tubes2' - 3 commits - sc/source tubes/inc tubes/qa tubes/source

Will Thompson wjt at kemper.freedesktop.org
Fri Mar 23 07:33:55 PDT 2012


 sc/source/ui/collab/collab.cxx |    3 +++
 tubes/inc/tubes/conference.hxx |    3 ++-
 tubes/qa/test_manager.cxx      |   11 ++++++++---
 tubes/source/conference.cxx    |   17 ++++++++++++++---
 tubes/source/manager.cxx       |    2 --
 5 files changed, 27 insertions(+), 9 deletions(-)

New commits:
commit 1e8d2df6c52ad41375982dac8d4b75d776544161
Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Fri Mar 23 14:24:56 2012 +0000

    tubes: push sent packets onto the incoming queue.
    
    This ensures that our changes are echoed locally as well as being sent
    to the peer.

diff --git a/tubes/inc/tubes/conference.hxx b/tubes/inc/tubes/conference.hxx
index 8a891d5..35812bb 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 a7e690f..f76353d 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 d48807d..4e218b8 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,
commit 79919ef4ebb080f3d01b5024aac465fb90462bb0
Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Fri Mar 23 14:19:11 2012 +0000

    tubes: delete some loop-spinning debug

diff --git a/tubes/source/manager.cxx b/tubes/source/manager.cxx
index f9ca143..5bd0f62 100644
--- a/tubes/source/manager.cxx
+++ b/tubes/source/manager.cxx
@@ -864,7 +864,6 @@ rtl::OString TeleManager::getFullObjectPath()
 void TeleManager::iterateLoop()
 {
     GMainContext* pContext = getMainContext();
-    SAL_INFO( "tubes.loop", "TeleManager::iterateLoop: once");
     g_main_context_iteration( pContext, TRUE);
 }
 
@@ -906,7 +905,6 @@ void TeleManager::flushLoop() const
         GMainContext* pContext = g_main_loop_get_context( pImpl->mpLoop);
         while (g_main_context_iteration( pContext, FALSE))
         {
-            SAL_INFO( "tubes.loop", "TeleManager::flushLoop");
         }
     }
 }
commit 8cf573e82ba33a43ce07a3dcc274f00c9ea7e175
Author: Will Thompson <will.thompson at collabora.co.uk>
Date:   Fri Mar 23 14:18:39 2012 +0000

    collab: print some info on which contact we've picked

diff --git a/sc/source/ui/collab/collab.cxx b/sc/source/ui/collab/collab.cxx
index fdb1a30..4c11fb7 100644
--- a/sc/source/ui/collab/collab.cxx
+++ b/sc/source/ui/collab/collab.cxx
@@ -83,12 +83,15 @@ bool ScCollaboration::initAccountContact()
 {
     ContactList* pContactList = mpManager->getContactList();
     AccountContactPairV aVec( pContactList->getContacts());
+
+    fprintf( stderr, "%u contacts\n", (int) aVec.size() );
     if (aVec.empty())
         return false;
 
     /* TODO: select a pair, for now just take the first */
     mpAccount = aVec[0].first;
     mpContact = aVec[0].second;
+    fprintf( stderr, "picked %s\n", tp_contact_get_identifier( mpContact ) );
     return true;
 }
 


More information about the Libreoffice-commits mailing list