Acceptor::~Acceptor()
{
m_rAcceptor->stopAccepting();
oslThread t;
{
std::unique_lock g(m_aMutex);
t = m_thread;
} //prevent locking if the thread is still waiting
m_bDying = true;
m_cEnable.set();
osl_joinWithThread(t);
osl_destroyThread(t);
{ // Make the final state of m_bridges visible to this thread (since // m_thread is joined, the code that follows is the only one left // accessing m_bridges):
std::unique_lock g(m_aMutex);
} for (;;) {
css::uno::Reference< css::bridge::XBridge > b(m_bridges.remove()); if (!b.is()) { break;
}
css::uno::Reference< css::lang::XComponent >(
b, css::uno::UNO_QUERY_THROW)->dispose();
}
}
void Acceptor::run()
{
SAL_INFO( "desktop.offacc", "Acceptor::run" ); for (;;)
{ try
{ // wait until we get enabled
SAL_INFO( "desktop.offacc", "Acceptor::run waiting for office to come up");
m_cEnable.wait(); if (m_bDying) //see destructor break;
SAL_INFO( "desktop.offacc", "Acceptor::run now enabled and continuing");
std::unique_lock g(m_aMutex);
// accept connection
Reference< XConnection > rConnection = m_rAcceptor->accept( m_aConnectString ); // if we return without a valid connection we must assume that the acceptor // is destructed so we break out of the run method terminating the thread if (! rConnection.is()) break;
OUString aDescription = rConnection->getDescription();
SAL_INFO( "desktop.offacc", "Acceptor::run connection " << aDescription );
// create instanceprovider for this connection
Reference< XInstanceProvider > rInstanceProvider(new AccInstanceProvider(m_rContext)); // create the bridge. The remote end will have a reference to this bridge // thus preventing the bridge from being disposed. When the remote end releases // the bridge, it will be destructed.
m_bridges.add(m_rBridgeFactory->createBridge(
u""_ustr, m_aProtocol, rConnection, rInstanceProvider));
} catch (const Exception&) {
TOOLS_WARN_EXCEPTION("desktop.offacc", ""); // connection failed... // something went wrong during connection setup. // just wait for a new connection to accept
}
}
}
extern"C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
desktop_Acceptor_get_implementation(
css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const&)
{ if (!officecfg::Office::Security::Net::AllowInsecureUNORemoteProtocol::get())
{ // this is not allowed to throw
SAL_WARN("desktop", "UNO Remote Protocol is disabled by configuration"); return nullptr;
} return cppu::acquire(new desktop::Acceptor(context));
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.