diff options
Diffstat (limited to 'automation/source/communi/communi.cxx')
-rw-r--r-- | automation/source/communi/communi.cxx | 63 |
1 files changed, 28 insertions, 35 deletions
diff --git a/automation/source/communi/communi.cxx b/automation/source/communi/communi.cxx index db319e206411..13ae2f2ea5b2 100644 --- a/automation/source/communi/communi.cxx +++ b/automation/source/communi/communi.cxx @@ -44,8 +44,8 @@ #include <automation/communi.hxx> -/* Um den Destruktor protected zu machen wurde unten das delete entfernt. - Die Methode wird ohnehin hucht benutzt. +/* The delete below has been removed to make the destructor protected. + The method isn't used anyway. // delete *((AE*)pData+n); */ @@ -67,7 +67,7 @@ _SV_SEEK_PTR( nm, AE ) SV_IMPL_PTRARR_SORT( CommunicationLinkList, CommunicationLink* ); -osl::Mutex *pMPostUserEvent=NULL; // Notwendig, da nicht threadfest +osl::Mutex *pMPostUserEvent=NULL; // necessary because not threadproof CommunicationLinkViaSocket::CommunicationLinkViaSocket( CommunicationManager *pMan, osl::StreamSocket* pSocket ) : SimpleCommunicationLinkViaSocket( pMan, pSocket ) @@ -126,10 +126,10 @@ sal_Bool CommunicationLinkViaSocket::ShutdownCommunication() if ( GetStreamSocket() ) GetStreamSocket()->shutdown(); - if ( GetStreamSocket() ) // Mal wieder nach oben verschoben, da sonst nicht vom Read runtergesprungen wird. + if ( GetStreamSocket() ) GetStreamSocket()->close(); - resume(); // So da� das run auch die Schleife verlassen kann + resume(); join(); @@ -137,7 +137,7 @@ sal_Bool CommunicationLinkViaSocket::ShutdownCommunication() SetStreamSocket( NULL ); delete pTempSocket; -// ConnectionClosed(); Wird am Ende des Thread gerufen +// ConnectionClosed(); is being called at the end of a thread } else @@ -205,7 +205,7 @@ void CommunicationLinkViaSocket::run() continue; TimeValue sNochEins = {0, 1000000}; - while ( schedule() && bIsInsideCallback ) // solange der letzte Callback nicht beendet ist + while ( schedule() && bIsInsideCallback ) wait( sNochEins ); SetNewPacketAsCurrent(); StartCallback(); @@ -216,7 +216,7 @@ void CommunicationLinkViaSocket::run() } } TimeValue sNochEins = {0, 1000000}; - while ( schedule() && bIsInsideCallback ) // solange der letzte Callback nicht beendet ist + while ( schedule() && bIsInsideCallback ) wait( sNochEins ); StartCallback(); @@ -235,23 +235,23 @@ sal_Bool CommunicationLinkViaSocket::DoTransferDataStream( SvStream *pDataStream return SimpleCommunicationLinkViaSocket::DoTransferDataStream( pDataStream, nProtocol ); } -/// Dies ist ein virtueller Link!!! +/// This is a virtual link! long CommunicationLinkViaSocket::ConnectionClosed( void* EMPTYARG ) { { osl::MutexGuard aGuard( aMConnectionClosed ); - nConnectionClosedEventId = 0; // Achtung!! alles andere mu� oben gemacht werden. + nConnectionClosedEventId = 0; // Attention!! everything else must be done above. } ShutdownCommunication(); return CommunicationLink::ConnectionClosed( ); } -/// Dies ist ein virtueller Link!!! +/// This is a virtual link! long CommunicationLinkViaSocket::DataReceived( void* EMPTYARG ) { { osl::MutexGuard aGuard( aMDataReceived ); - nDataReceivedEventId = 0; // Achtung!! alles andere mu� oben gemacht werden. + nDataReceivedEventId = 0; // Attention!! everything else must be done above. } return CommunicationLink::DataReceived( ); } @@ -297,8 +297,7 @@ MultiCommunicationManager::~MultiCommunicationManager() } } - // Alles weghauen, was nicht rechtzeitig auf die B�ume gekommen ist - // Was bei StopCommunication �brig geblieben ist, da es sich asynchron austragen wollte + sal_uInt16 i = ActiveLinks->Count(); while ( i-- ) { @@ -309,9 +308,7 @@ MultiCommunicationManager::~MultiCommunicationManager() } delete ActiveLinks; - /// Die Links zwischen ConnectionClosed und Destruktor. - /// Hier NICHT gerefcounted, da sie sich sonst im Kreis festhaten w�rden, - /// da die Links sich erst in ihrem Destruktor austragen + i = InactiveLinks->Count(); while ( i-- ) { @@ -324,15 +321,13 @@ MultiCommunicationManager::~MultiCommunicationManager() sal_Bool MultiCommunicationManager::StopCommunication() { - // Alle Verbindungen abbrechen - // ConnectionClosed entfernt die Links aus der Liste. Je nach Implementation syncron - // oder asyncron. Daher Von oben nach unten Abr�umen, so da� sich nichts verschiebt. + sal_uInt16 i = ActiveLinks->Count(); int nFail = 0; while ( i ) { if ( !ActiveLinks->GetObject(i-1)->StopCommunication() ) - nFail++; // Hochz�hlen, da Verbindung sich nicht (sofort) beenden l�sst. + nFail++; i--; } @@ -359,7 +354,7 @@ CommunicationLinkRef MultiCommunicationManager::GetCommunicationLink( sal_uInt16 void MultiCommunicationManager::CallConnectionOpened( CommunicationLink* pCL ) { - CommunicationLinkRef rHold(pCL); // H�lt den Zeiger bis zum Ende des calls + CommunicationLinkRef rHold(pCL); ActiveLinks->C40_PTR_INSERT(CommunicationLink, pCL); rHold->AddRef(); @@ -368,14 +363,14 @@ void MultiCommunicationManager::CallConnectionOpened( CommunicationLink* pCL ) void MultiCommunicationManager::CallConnectionClosed( CommunicationLink* pCL ) { - CommunicationLinkRef rHold(pCL); // H�lt denm Zeiger bis zum Ende des calls + CommunicationLinkRef rHold(pCL); CommunicationManager::CallConnectionClosed( pCL ); sal_uInt16 nPos; if ( ActiveLinks->Seek_Entry( pCL, &nPos ) ) { - InactiveLinks->C40_PTR_INSERT(CommunicationLink, pCL); // Ohne Reference + InactiveLinks->C40_PTR_INSERT(CommunicationLink, pCL); // without reference ActiveLinks->Remove( nPos ); } pCL->ReleaseReference(); @@ -430,11 +425,9 @@ sal_Bool CommunicationManagerServerViaSocket::StartCommunication() sal_Bool CommunicationManagerServerViaSocket::StopCommunication() { - // Erst den Acceptor anhalten delete pAcceptThread; pAcceptThread = NULL; - // Dann alle Verbindungen kappen return CommunicationManagerServer::StopCommunication(); } @@ -461,16 +454,16 @@ CommunicationManagerServerAcceptThread::CommunicationManagerServerAcceptThread( CommunicationManagerServerAcceptThread::~CommunicationManagerServerAcceptThread() { -#ifndef aUNX // Weil das Accept nicht abgebrochen werden kann, so terminiert wenigstens das Prog - // #62855# pl: gilt auch bei anderen Unixen - // die richtige Loesung waere natuerlich, etwas auf die pipe zu schreiben, - // was der thread als Abbruchbedingung erkennt - // oder wenigstens ein kill anstatt join +#ifndef aUNX // because the accept can't be canceled - this way the prog's terminated at leastW + // #62855# pl: counts for other unix systems too + // correct solution would be of course to write something on the pipe which + // the thread recognizes as a cancelling condition + // or at least kill instead of join terminate(); if ( pAcceptorSocket ) - pAcceptorSocket->close(); // Dann das Accept unterbrechen + pAcceptorSocket->close(); - join(); // Warten bis fertig + join(); if ( pAcceptorSocket ) { @@ -491,7 +484,7 @@ CommunicationManagerServerAcceptThread::~CommunicationManagerServerAcceptThread( CByteString( "AddConnectionEvent aus Queue gel�scht"), CM_MISC, xNewConnection ); xNewConnection->InvalidateManager(); - xNewConnection.Clear(); // sollte das Objekt hier l�schen + xNewConnection.Clear(); } } } @@ -527,7 +520,7 @@ void CommunicationManagerServerAcceptThread::run() pStreamSocket->setOption( osl_Socket_OptionTcpNoDelay, 1 ); TimeValue sNochEins = {0, 100}; - while ( schedule() && xmNewConnection.Is() ) // Solange die letzte Connection nicht abgeholt wurde warten wir + while ( schedule() && xmNewConnection.Is() ) wait( sNochEins ); xmNewConnection = new CommunicationLinkViaSocket( pMyServer, pStreamSocket ); xmNewConnection->StartCallback(); |