diff options
author | Jörg Budischewski <jbu@openoffice.org> | 2002-01-07 08:17:07 +0000 |
---|---|---|
committer | Jörg Budischewski <jbu@openoffice.org> | 2002-01-07 08:17:07 +0000 |
commit | 8de335ab232e9022e51270faaeb9133535305b1d (patch) | |
tree | 0f95b15c5258f2357b67e6e0d464d1877eba564a /io | |
parent | 2413d9e0bcaf90d84ff8b37d0be4721ebfc8fc42 (diff) |
#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
Diffstat (limited to 'io')
-rw-r--r-- | io/source/acceptor/acc_pipe.cxx | 34 | ||||
-rw-r--r-- | io/source/acceptor/acceptor.hxx | 5 |
2 files changed, 33 insertions, 6 deletions
diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx index fa5cee72993a..4166ca33a876 100644 --- a/io/source/acceptor/acc_pipe.cxx +++ b/io/source/acceptor/acc_pipe.cxx @@ -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(); + } } } diff --git a/io/source/acceptor/acceptor.hxx b/io/source/acceptor/acceptor.hxx index 7a5b47066651..2c71513d5896 100644 --- a/io/source/acceptor/acceptor.hxx +++ b/io/source/acceptor/acceptor.hxx @@ -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; |