diff options
author | Jörg Budischewski <jbu@openoffice.org> | 2001-05-14 08:57:58 +0000 |
---|---|---|
committer | Jörg Budischewski <jbu@openoffice.org> | 2001-05-14 08:57:58 +0000 |
commit | caace7245dfaf5da8a46b9b68411c2e5ccc21a55 (patch) | |
tree | 7e18fb09c42376d11dabe378cb44235a8ba6ace4 /bridges | |
parent | f902d5b74db405e523646c32f17de95f3a3ee23c (diff) |
incompatible threadpool changes
Diffstat (limited to 'bridges')
-rw-r--r-- | bridges/source/remote/urp/urp_bridgeimpl.cxx | 32 | ||||
-rw-r--r-- | bridges/source/remote/urp/urp_bridgeimpl.hxx | 9 | ||||
-rw-r--r-- | bridges/source/remote/urp/urp_environment.cxx | 14 | ||||
-rw-r--r-- | bridges/source/remote/urp/urp_job.cxx | 65 | ||||
-rw-r--r-- | bridges/source/remote/urp/urp_job.hxx | 5 | ||||
-rw-r--r-- | bridges/source/remote/urp/urp_reader.cxx | 180 | ||||
-rw-r--r-- | bridges/source/remote/urp/urp_reader.hxx | 11 |
7 files changed, 209 insertions, 107 deletions
diff --git a/bridges/source/remote/urp/urp_bridgeimpl.cxx b/bridges/source/remote/urp/urp_bridgeimpl.cxx index abc19116707d..464346fcdb84 100644 --- a/bridges/source/remote/urp/urp_bridgeimpl.cxx +++ b/bridges/source/remote/urp/urp_bridgeimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: urp_bridgeimpl.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: jbu $ $Date: 2001-05-02 14:01:28 $ + * last change: $Author: jbu $ $Date: 2001-05-14 09:57:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -65,6 +65,7 @@ #include "urp_bridgeimpl.hxx" using namespace ::rtl; +using namespace ::osl; using namespace ::com::sun::star::uno; namespace bridges_urp { @@ -232,22 +233,27 @@ void urp_BridgeImpl::applyProtocolChanges( const Properties &props ) void urp_BridgeImpl::addError( char *pError ) { - OUString message = OUString::valueOf( (sal_Int32 ) osl_getThreadIdentifier( 0 ) ); - message += OUString::createFromAscii( ": " ); + OUString message = OUString( RTL_CONSTASCII_USTRINGPARAM( "(tid=" ) ); + message += OUString::valueOf( (sal_Int32 ) osl_getThreadIdentifier( 0 ) ); + message += OUString::createFromAscii( ") " ); message += OUString::createFromAscii( pError ); + MutexGuard guard( m_errorListMutex ); m_lstErrors.push_back( message ); } void urp_BridgeImpl::addError( const OUString & error ) { - OUString message = OUString::valueOf( (sal_Int32 ) osl_getThreadIdentifier( 0 ) ); - message += OUString::createFromAscii( ": " ); + OUString message = OUString( RTL_CONSTASCII_USTRINGPARAM( "(tid=" ) ); + message += OUString::valueOf( (sal_Int32 ) osl_getThreadIdentifier( 0 ) ); + message += OUString::createFromAscii( ") " ); message += error; + MutexGuard guard( m_errorListMutex ); m_lstErrors.push_back( message ); } void urp_BridgeImpl::dumpErrors( FILE * f) { + MutexGuard guard( m_errorListMutex ); for( ::std::list< OUString >::iterator ii = m_lstErrors.begin() ; ii != m_lstErrors.end() ; ++ii ) @@ -256,4 +262,18 @@ void urp_BridgeImpl::dumpErrors( FILE * f) fprintf( f, "%s\n" , o.getStr() ); } } + +OUString urp_BridgeImpl::getErrorsAsString( ) +{ + MutexGuard guard( m_errorListMutex ); + OUString ret; + for( ::std::list< OUString >::iterator ii = m_lstErrors.begin() ; + ii != m_lstErrors.end() ; + ++ii ) + { + ret += *ii; + } + return ret; +} + } diff --git a/bridges/source/remote/urp/urp_bridgeimpl.hxx b/bridges/source/remote/urp/urp_bridgeimpl.hxx index 8294c520f543..bfa7445ce166 100644 --- a/bridges/source/remote/urp/urp_bridgeimpl.hxx +++ b/bridges/source/remote/urp/urp_bridgeimpl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: urp_bridgeimpl.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: jbu $ $Date: 2001-05-02 14:01:28 $ + * last change: $Author: jbu $ $Date: 2001-05-14 09:57:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -68,6 +68,8 @@ #include <rtl/ustring.hxx> #include <rtl/byteseq.hxx> +#include <uno/threadpool.h> + #include <bridges/remote/bridgeimpl.hxx> #include "urp_cache.hxx" @@ -114,9 +116,11 @@ struct urp_BridgeImpl : void addError( char *pError ); void addError( const ::rtl::OUString &anError ); void dumpErrors( FILE *f ); + ::rtl::OUString getErrorsAsString(); ::osl::Mutex m_marshalingMutex; ::osl::Mutex m_disposingMutex; + ::osl::Mutex m_errorListMutex; Marshal m_blockMarshaler; sal_Int32 m_nMarshaledMessages; @@ -149,6 +153,7 @@ struct urp_BridgeImpl : struct Properties m_properties; class PropertyObject *m_pPropertyObject; ::std::list< ::rtl::OUString > m_lstErrors; + uno_ThreadPool m_hThreadPool; }; diff --git a/bridges/source/remote/urp/urp_environment.cxx b/bridges/source/remote/urp/urp_environment.cxx index 0b3ba2960727..f4bddc4d01e2 100644 --- a/bridges/source/remote/urp/urp_environment.cxx +++ b/bridges/source/remote/urp/urp_environment.cxx @@ -2,9 +2,9 @@ * * $RCSfile: urp_environment.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: pl $ $Date: 2001-05-11 09:03:33 $ + * last change: $Author: jbu $ $Date: 2001-05-14 09:57:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -327,7 +327,7 @@ void RemoteEnvironment::thisDispose( uno_Environment *pEnvRemote ) } // from now on, no calls can be delivered via the bridge - uno_threadpool_disposeThreads( (sal_Int64) pEnvRemote ); + uno_threadpool_dispose( pImpl->m_hThreadPool ); pContext->m_pConnection->close( pContext->m_pConnection ); @@ -356,7 +356,9 @@ void RemoteEnvironment::thisDispose( uno_Environment *pEnvRemote ) pImpl->m_pLogFile = 0; } #endif +#ifdef DEBUG pImpl->dumpErrors( stderr ); +#endif // destroy the threads delete pImpl->m_pWriter; @@ -376,7 +378,6 @@ void RemoteEnvironment::thisDispose( uno_Environment *pEnvRemote ) } } - void RemoteEnvironment::thisDisposing( uno_Environment *pEnvRemote ) { remote_Context *pContext = (remote_Context * )pEnvRemote->pContext; @@ -393,7 +394,7 @@ void RemoteEnvironment::thisDisposing( uno_Environment *pEnvRemote ) pImpl->m_pPropertyObject->thisRelease(); pImpl->m_pPropertyObject = 0; - uno_threadpool_stopDisposeThreads( (sal_Int64) pEnvRemote ); + uno_threadpool_destroy( pImpl->m_hThreadPool ); pContext->aBase.release( (uno_Context * ) pContext ); #ifdef DEBUG @@ -441,6 +442,9 @@ extern "C" SAL_DLLEXPORT void SAL_CALL uno_initEnvironment( urp_BridgeImpl *pImpl = new ::bridges_urp::urp_BridgeImpl( 256, 8192 ); pContext->m_pBridgeImpl = pImpl; + // Initialize threadpool + pImpl->m_hThreadPool = uno_threadpool_create(); + // take the bridgepointer as id pImpl->m_properties.seqBridgeID = ByteSequence( (sal_Int8*)&pEnvRemote , sizeof( pEnvRemote ) ); diff --git a/bridges/source/remote/urp/urp_job.cxx b/bridges/source/remote/urp/urp_job.cxx index 2cf78e3744f2..7bce1f7ddb54 100644 --- a/bridges/source/remote/urp/urp_job.cxx +++ b/bridges/source/remote/urp/urp_job.cxx @@ -2,9 +2,9 @@ * * $RCSfile: urp_job.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: jbu $ $Date: 2001-05-02 14:01:28 $ + * last change: $Author: jbu $ $Date: 2001-05-14 09:57:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -189,7 +189,7 @@ namespace bridges_urp //------------------------------------------------------------------------------------------- void ClientJob::initiate() { - uno_threadpool_putReply( m_pTid , (sal_Int8*) this ); + uno_threadpool_putJob( m_pBridgeImpl->m_hThreadPool, m_pTid , this, 0, sal_False); } //-------------------------------------------------------------------------------------------- @@ -348,7 +348,7 @@ namespace bridges_urp if( ! m_bOneway ) { - m_pThreadpoolHandle = uno_threadpool_createHandle( (sal_Int64 ) m_pEnvRemote ); + uno_threadpool_attach( m_pBridgeImpl->m_hThreadPool ); m_pBridgeImpl->m_clientJobContainer.add( *(ByteSequence*)&(m_pTid), this ); } @@ -369,32 +369,38 @@ namespace bridges_urp //------------------------------------------------------------------------------------ void ClientJob::wait() { - if(! m_bOneway) - { - //--------------------------- - // Wait for the reply - //--------------------------- - ClientJob * pData = 0; - uno_threadpool_enter( m_pThreadpoolHandle, (void **) &pData ); + //--------------------------- + // Wait for the reply + //--------------------------- + void * pDisposeReason = 0; - if( ! pData ) + uno_threadpool_enter(m_pBridgeImpl->m_hThreadPool, &pDisposeReason ); + + if( ! pDisposeReason ) + { + // thread has been disposed ! + // avoid leak due continous calling on a disposed reference. + if( m_pBridgeImpl->m_clientJobContainer.remove( *(ByteSequence*) &m_pTid ) ) { - // avoid leak due continous calling on a disposed reference. - if( m_pBridgeImpl->m_clientJobContainer.remove( *(ByteSequence*) &m_pTid ) ) - { - // OK, we retrieved the job from the container - prepareRuntimeExceptionClientSide( - m_ppException, OUString( RTL_CONSTASCII_USTRINGPARAM( "URP_Bridge : disposed" ) ) ); - } - else - { - // if pData == 0, the Job MUST BE still in the container, - // because the threadpool is disposed after the reader thread - // is in a known state. - OSL_ASSERT( !"we should never be here" ); - } + // OK, we retrieved the job from the container + OUString sMessage( RTL_CONSTASCII_USTRINGPARAM( "URP_Bridge : disposed\n" ) ); + sMessage += m_pBridgeImpl->getErrorsAsString(); + prepareRuntimeExceptionClientSide( m_ppException, sMessage ); + } + else + { + // the Job MUST BE still in the container, + // because the threadpool is disposed after the reader thread + // is in a known state. + OSL_ASSERT( !"we should never be here" ); } } + else + { + OSL_ASSERT( pDisposeReason == (void*)this ); + } + + uno_threadpool_detach( m_pBridgeImpl->m_hThreadPool ); } //------------------------------------------------------------------------------------ @@ -691,8 +697,11 @@ namespace bridges_urp //------------------------------------------------------------------------------------- void ServerMultiJob::initiate() { - uno_threadpool_putRequest( - m_pTid, this, doit, + uno_threadpool_putJob( + m_pBridgeImpl->m_hThreadPool, + m_pTid, + this, + doit, m_aTypeInfo[0].m_bIsOneway ); } diff --git a/bridges/source/remote/urp/urp_job.hxx b/bridges/source/remote/urp/urp_job.hxx index 02e66e264071..d78b10f391fc 100644 --- a/bridges/source/remote/urp/urp_job.hxx +++ b/bridges/source/remote/urp/urp_job.hxx @@ -2,9 +2,9 @@ * * $RCSfile: urp_job.hxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: jbu $ $Date: 2001-05-02 14:01:28 $ + * last change: $Author: jbu $ $Date: 2001-05-14 09:57:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -158,7 +158,6 @@ private: typelib_InterfaceTypeDescription *m_pInterfaceType; sal_Bool m_bReleaseForTypeDescriptionNecessary; - uno_threadpool_Handle *m_pThreadpoolHandle; uno_Any **m_ppException; sal_Bool m_bOneway; sal_Bool m_bBridgePropertyCall; diff --git a/bridges/source/remote/urp/urp_reader.cxx b/bridges/source/remote/urp/urp_reader.cxx index 435dcaeda937..bb9ff2444288 100644 --- a/bridges/source/remote/urp/urp_reader.cxx +++ b/bridges/source/remote/urp/urp_reader.cxx @@ -2,9 +2,9 @@ * * $RCSfile: urp_reader.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: jbu $ $Date: 2001-05-02 14:01:28 $ + * last change: $Author: jbu $ $Date: 2001-05-14 09:57:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -132,75 +132,101 @@ namespace bridges_urp }; // end struct MessageFlags - inline sal_Bool getMemberTypeDescription( - typelib_InterfaceAttributeTypeDescription **ppAttributeType, - typelib_InterfaceMethodTypeDescription **ppMethodType, - sal_Bool *pbIsSetter, - sal_uInt16 nMethodId , - const Type &typeInterface) +inline sal_Bool OReaderThread::getMemberTypeDescription( + typelib_InterfaceAttributeTypeDescription **ppAttributeType, + typelib_InterfaceMethodTypeDescription **ppMethodType, + sal_Bool *pbIsSetter, + sal_uInt16 nMethodId , + typelib_TypeDescriptionReference * pITypeRef ) +{ + if( pITypeRef->eTypeClass != typelib_TypeClass_INTERFACE ) { - if( typeInterface.getTypeClass() != typelib_TypeClass_INTERFACE ) - { - OSL_ENSURE( 0 , "type is not an interface" ); - return sal_False; - } + OUString sMessage( RTL_CONSTASCII_USTRINGPARAM( "interface type is not of typeclass interface (" )); + sMessage += OUString::valueOf( (sal_Int32) pITypeRef->eTypeClass ); + m_pBridgeImpl->addError( sMessage ); + OSL_ENSURE( 0 , "type is not an interface" ); + return sal_False; + } - typelib_InterfaceTypeDescription *pInterfaceType = 0; - TYPELIB_DANGER_GET( - (typelib_TypeDescription **)&pInterfaceType , typeInterface.getTypeLibType() ); - if( ! pInterfaceType ) - { - OString o = OUStringToOString( typeInterface.getTypeName() , RTL_TEXTENCODING_ASCII_US ); - OSL_ENSURE( !"urp: unknown type " , o.getStr() ); - return sal_False; - } + typelib_InterfaceTypeDescription *pInterfaceType = 0; + TYPELIB_DANGER_GET( + (typelib_TypeDescription **)&pInterfaceType , pITypeRef ); + if( ! pInterfaceType ) + { + OUString sMessage( RTL_CONSTASCII_USTRINGPARAM( "No typedescription can be retrieved for type " )); + sMessage += pITypeRef->pTypeName; + m_pBridgeImpl->addError( sMessage ); + OSL_ENSURE( 0 , "urp: unknown type " ); + return sal_False; + } - if( ! pInterfaceType->aBase.bComplete ) - { - typelib_typedescription_complete( (typelib_TypeDescription **) &pInterfaceType ); - } + if( ! pInterfaceType->aBase.bComplete ) + { + typelib_typedescription_complete( (typelib_TypeDescription **) &pInterfaceType ); + } - if( nMethodId < 0 || nMethodId > pInterfaceType->nAllMembers *2 ) - { - // ( m_nMethodId > m_pInterfaceType->nAllMembers *2) is an essential condition - // for the vtable index to be correct + if( nMethodId < 0 || nMethodId > pInterfaceType->nAllMembers *2 ) + { + OUString sMessage( RTL_CONSTASCII_USTRINGPARAM( "vtable out of range for type " )); + sMessage += pITypeRef->pTypeName; + sMessage += OUString::createFromAscii( " (" ); + sMessage += OUString::valueOf( (sal_Int32) nMethodId ); + sMessage += OUString::createFromAscii( " )" ); + m_pBridgeImpl->addError( sMessage ); + + // (nMethodId > pInterfaceType->nAllMembers *2) is an essential condition + // for the vtable index to be correct OSL_ENSURE( 0 , "vtable index out of range" ); return sal_False; - } - - // TODO : check the range of m_nMethodId - sal_Int32 nMemberIndex = pInterfaceType->pMapFunctionIndexToMemberIndex[ nMethodId ]; + } - if( !( pInterfaceType->nAllMembers > nMemberIndex && nMemberIndex >= 0 ) ) - { - OSL_ENSURE( 0 , "vtable index out of range" ); - return sal_False; - } + // TODO : check the range of nMethodId + sal_Int32 nMemberIndex = pInterfaceType->pMapFunctionIndexToMemberIndex[ nMethodId ]; - typelib_InterfaceMemberTypeDescription *pMemberType = 0; - typelib_typedescriptionreference_getDescription( - (typelib_TypeDescription **) &pMemberType,pInterfaceType->ppAllMembers[nMemberIndex]); + if( !( pInterfaceType->nAllMembers > nMemberIndex && nMemberIndex >= 0 ) ) + { + OUString sMessage( RTL_CONSTASCII_USTRINGPARAM( "vtable out of range for type " )); + sMessage += pITypeRef->pTypeName; + sMessage += OUString::createFromAscii( " (" ); + sMessage += OUString::valueOf( (sal_Int32) nMethodId ); + sMessage += OUString::createFromAscii( " )" ); + m_pBridgeImpl->addError( sMessage ); + + OSL_ENSURE( 0 , "vtable index out of range" ); + return sal_False; + } - if(! pMemberType ) - { - OSL_ENSURE( 0 , "unknown method type description" ); - return sal_False; - } + typelib_InterfaceMemberTypeDescription *pMemberType = 0; + typelib_typedescriptionreference_getDescription( + (typelib_TypeDescription **) &pMemberType,pInterfaceType->ppAllMembers[nMemberIndex]); - if( typelib_TypeClass_INTERFACE_ATTRIBUTE == pMemberType->aBase.eTypeClass ) - { - *ppAttributeType = (typelib_InterfaceAttributeTypeDescription *) pMemberType; - *pbIsSetter = ! ( - pInterfaceType->pMapMemberIndexToFunctionIndex[nMemberIndex] == nMethodId ); - } - else - { - *ppMethodType = (typelib_InterfaceMethodTypeDescription *) pMemberType; - } + if(! pMemberType ) + { + OUString sMessage( RTL_CONSTASCII_USTRINGPARAM( "unknown method type description for type" ) ); + sMessage += pITypeRef->pTypeName; + sMessage += OUString::createFromAscii( " (" ); + sMessage += OUString::valueOf( (sal_Int32) nMethodId ); + sMessage += OUString::createFromAscii( " )" ); + m_pBridgeImpl->addError( sMessage ); + + OSL_ENSURE( 0 , "unknown method type description" ); + return sal_False; + } - TYPELIB_DANGER_RELEASE( (typelib_TypeDescription * )pInterfaceType ); - return sal_True; + if( typelib_TypeClass_INTERFACE_ATTRIBUTE == pMemberType->aBase.eTypeClass ) + { + *ppAttributeType = (typelib_InterfaceAttributeTypeDescription *) pMemberType; + *pbIsSetter = ! ( + pInterfaceType->pMapMemberIndexToFunctionIndex[nMemberIndex] == nMethodId ); } + else + { + *ppMethodType = (typelib_InterfaceMethodTypeDescription *) pMemberType; + } + + TYPELIB_DANGER_RELEASE( (typelib_TypeDescription * )pInterfaceType ); + return sal_True; +} OReaderThread::OReaderThread( remote_Connection *pConnection, uno_Environment *pEnvRemote, @@ -275,6 +301,8 @@ inline sal_Bool OReaderThread::readBlock( sal_Int32 *pnMessageCount ) m_unmarshal.setSize( 8 ); if( 8 != m_pConnection->read( m_pConnection , m_unmarshal.getBuffer(), 8 ) ) { + OUString s( RTL_CONSTASCII_USTRINGPARAM( "Unexpected connection closure" ) ); + m_pBridgeImpl->addError( s ); return sal_False; } @@ -287,19 +315,28 @@ inline sal_Bool OReaderThread::readBlock( sal_Int32 *pnMessageCount ) // buffer too big // no exception can be thrown, because there is no thread id, which could be // used. -> terminate ! - OSL_ENSURE( 0 , "urp bridge: invalid message size, terminating connection." ); + OUString s( RTL_CONSTASCII_USTRINGPARAM( "Packet-size too big (" ) ); + s += OUString::valueOf( (sal_Int64) (sal_uInt32 ) nSize ); + s += OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ) ); + m_pBridgeImpl->addError( s ); + OSL_ENSURE( 0 , "urp bridge: Packet-size too big" ); disposeEnvironment(); return sal_False; } if( 0 == nSize ) { + // normal termination ! return sal_False; } // allocate the necessary memory if( ! m_unmarshal.setSize( nSize ) ) { + OUString s( RTL_CONSTASCII_USTRINGPARAM( "Packet-size too big, couln't allocate necessary memory (" ) ); + s += OUString::valueOf( (sal_Int64) (sal_uInt32 ) nSize ); + s += OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ) ); + m_pBridgeImpl->addError( s ); OSL_ENSURE( 0 , "urp bridge: messages size too large, terminating connection" ); return sal_False; } @@ -308,9 +345,15 @@ inline sal_Bool OReaderThread::readBlock( sal_Int32 *pnMessageCount ) if( nSize != nRead ) { + OUString s( RTL_CONSTASCII_USTRINGPARAM( "Unexpected connection closure, inconsistent packet (" ) ); + s += OUString::valueOf( (sal_Int64) (sal_uInt32 ) nSize ); + s += OUString( RTL_CONSTASCII_USTRINGPARAM( " asked, " ) ); + s += OUString::valueOf( (sal_Int64) (sal_uInt32 ) nRead ); + s += OUString( RTL_CONSTASCII_USTRINGPARAM( " got )" ) ); + m_pBridgeImpl->addError( s ); // couldn't get the asked amount of bytes, quit // should only occur, when the environment has already been disposed - OSL_ENSURE( m_pBridgeImpl->m_bDisposed , "urp bridge: couldn't read complete message, terminating connection." ); + OSL_ENSURE( m_pBridgeImpl->m_bDisposed , "urp bridge: inconsistent packet, terminating connection." ); return sal_False; } return sal_True; @@ -321,6 +364,7 @@ inline sal_Bool OReaderThread::readFlags( struct MessageFlags *pFlags ) sal_uInt8 nBitField; if( ! m_unmarshal.unpackInt8( &nBitField ) ) { + m_pBridgeImpl->addError( "Unexpected end of message header (1)" ); return sal_False; } @@ -344,6 +388,7 @@ inline sal_Bool OReaderThread::readFlags( struct MessageFlags *pFlags ) sal_Int8 moreFlags; if( ! m_unmarshal.unpackInt8( &moreFlags ) ) { + m_pBridgeImpl->addError( "Unexpected end of message header (2)" ); return sal_False; } pFlags->bSynchronous = ( HDRFLAG_SYNCHRONOUS & moreFlags ); @@ -358,6 +403,7 @@ inline sal_Bool OReaderThread::readFlags( struct MessageFlags *pFlags ) // methodid as unsigned short if( ! m_unmarshal.unpackInt16( &(pFlags->nMethodId )) ) { + m_pBridgeImpl->addError( "Unexpected end of message header (3)" ); return sal_False; } } @@ -366,6 +412,7 @@ inline sal_Bool OReaderThread::readFlags( struct MessageFlags *pFlags ) sal_uInt8 id; if( ! m_unmarshal.unpackInt8( &id ) ) { + m_pBridgeImpl->addError( "Unexpected end of message header (4)" ); return sal_False; } pFlags->nMethodId = (sal_uInt16) id; @@ -387,6 +434,7 @@ inline sal_Bool OReaderThread::readFlags( struct MessageFlags *pFlags ) sal_uInt8 lower; if( ! m_unmarshal.unpackInt8( &lower ) ) { + m_pBridgeImpl->addError( "Unexpected end of message header (5)" ); return sal_False; } pFlags->nMethodId = ( nBitField & 0x3f ) << 8 | lower; @@ -435,6 +483,7 @@ void OReaderThread::run() if( ! readFlags( &flags ) ) { + m_pBridgeImpl->addError( "incomplete message, skipping block" ); OSL_ENSURE ( 0 , "urp-bridge : incomplete message, skipping block" ); break; } @@ -467,12 +516,16 @@ void OReaderThread::run() else { typelib_typedescriptionreference_release( pTypeRef ); + m_pBridgeImpl->addError( "error during unpacking (maybe cached) interface type" ); OSL_ENSURE( 0 , "urp-bridge : error during unpacking interface type, terminating connection" ); disposeEnvironment(); break; } if( m_pBridgeImpl->m_lastInType.getTypeClass() != typelib_TypeClass_INTERFACE ) { + OUString sMessage( RTL_CONSTASCII_USTRINGPARAM( "interface type is not of typeclass interface (" )); + sMessage += OUString::valueOf( (sal_Int32) m_pBridgeImpl->m_lastInType.getTypeClass() ); + m_pBridgeImpl->addError( sMessage ); OSL_ENSURE( 0 , "urp-bridge : not an interface type" ); disposeEnvironment(); break; @@ -489,6 +542,7 @@ void OReaderThread::run() else { rtl_uString_release( pOid ); + m_pBridgeImpl->addError( "error during unpacking (maybe cached) oid" ); OSL_ENSURE( 0 , "urp-bridge : error during unpacking cached data, terminating connection" ); disposeEnvironment(); break; @@ -507,6 +561,7 @@ void OReaderThread::run() { rtl_byte_sequence_release( pSeq ); + m_pBridgeImpl->addError( "error during unpacking (maybe cached) tid" ); OSL_ENSURE( 0 , "urp-bridge : error during unpacking cached data, terminating connection" ); disposeEnvironment(); break; @@ -541,6 +596,9 @@ void OReaderThread::run() *ppLastType ); if( !pInterfaceType ) { + OUString sMessage( RTL_CONSTASCII_USTRINGPARAM( "Couldn't retrieve type description for type " ) ); + sMessage += (*ppLastType)->pTypeName; + m_pBridgeImpl->addError( sMessage ); delete pMultiJob; pMultiJob = 0; disposeEnvironment(); diff --git a/bridges/source/remote/urp/urp_reader.hxx b/bridges/source/remote/urp/urp_reader.hxx index cae144685101..0272776c742f 100644 --- a/bridges/source/remote/urp/urp_reader.hxx +++ b/bridges/source/remote/urp/urp_reader.hxx @@ -2,9 +2,9 @@ * * $RCSfile: urp_reader.hxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: jbu $ $Date: 2001-05-02 14:01:28 $ + * last change: $Author: jbu $ $Date: 2001-05-14 09:57:58 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,6 +92,13 @@ public: private: void disposeEnvironment(); + inline sal_Bool getMemberTypeDescription( + typelib_InterfaceAttributeTypeDescription **ppAttributeType, + typelib_InterfaceMethodTypeDescription **ppMethodType, + sal_Bool *pbIsSetter, + sal_uInt16 nMethodId , + typelib_TypeDescriptionReference *pITypeRef); + remote_Connection *m_pConnection; uno_Environment *m_pEnvRemote; OWriterThread *m_pWriterThread; |