#96257# exception now thrown in case pipe-accept fails, a new pipe can now accept, after shutdown a previous shutdown on a pipe with identical pipename has returned

This commit is contained in:
Jörg Budischewski 2002-01-07 08:17:07 +00:00
parent 2413d9e0bc
commit 8de335ab23
2 changed files with 33 additions and 6 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: acc_pipe.cxx,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: jbu $ $Date: 2001-06-22 16:32:55 $
* last change: $Author: jbu $ $Date: 2002-01-07 09:17:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -193,13 +193,30 @@ namespace io_acceptor
void PipeAcceptor::init()
{
m_pipe = Pipe( m_sPipeName.pData , osl_Pipe_CREATE );
if( ! m_pipe.is() )
{
OUString error = OUString::createFromAscii( "io.acceptor: Couldn't setup pipe " );
error += m_sPipeName;
throw ConnectionSetupException( error, Reference< XInterface > () );
}
}
Reference< XConnection > PipeAcceptor::accept( )
{
Pipe pipe;
{
MutexGuard guard( m_mutex );
pipe = m_pipe;
}
if( ! pipe.is() )
{
OUString error = OUString::createFromAscii( "io.acceptor: pipe already closed" );
error += m_sPipeName;
throw ConnectionSetupException( error, Reference< XInterface > () );
}
PipeConnection *pConn = new PipeConnection( m_sPipeName , m_sConnectionDescription );
oslPipeError status = m_pipe.accept( pConn->m_pipe );
oslPipeError status = pipe.accept( pConn->m_pipe );
if( m_bClosed )
{
@ -222,6 +239,15 @@ namespace io_acceptor
void PipeAcceptor::stopAccepting()
{
m_bClosed = sal_True;
m_pipe.close();
Pipe pipe;
{
MutexGuard guard( m_mutex );
pipe = m_pipe;
m_pipe.clear();
}
if( pipe.is() )
{
pipe.close();
}
}
}

View file

@ -2,9 +2,9 @@
*
* $RCSfile: acceptor.hxx,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: jbu $ $Date: 2001-06-22 16:32:55 $
* last change: $Author: jbu $ $Date: 2002-01-07 09:17:07 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -87,6 +87,7 @@ namespace io_acceptor {
void stopAccepting();
::osl::Mutex m_mutex;
::osl::Pipe m_pipe;
::rtl::OUString m_sPipeName;
::rtl::OUString m_sConnectionDescription;