Kaydet (Commit) aebe0af1 authored tarafından Will Thompson's avatar Will Thompson Kaydeden (comit) Matúš Kukan

tubes: push sent packets onto the incoming queue.

This ensures that our changes are echoed locally as well as being sent
to the peer.
üst c0d0ad88
......@@ -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);
......
......@@ -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)
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment