21#include <rtl/ustring.hxx>
24#include <osl/thread.hxx>
27#include <com/sun/star/ucb/LockScope.hpp>
58void TickerThread::execute()
60 osl_setThreadName(
"http_dav_ucp::TickerThread");
62 SAL_INFO(
"ucb.ucp.webdav",
"TickerThread: start." );
76 std::this_thread::sleep_for( std::chrono::milliseconds(1000/25) );
79 SAL_INFO(
"ucb.ucp.webdav",
"TickerThread: stop." );
96 "SerfLockStore::~SerfLockStore - Releasing active locks!" );
100 rLockInfo.second.m_xSession->NonInteractive_UNLOCK(rLockInfo.first);
106 std::unique_lock aGuard(
m_aMutex );
130 if (pTickerThread.is() && pTickerThread->getIdentifier() != osl::Thread::getCurrentIdentifier())
132 pTickerThread->join();
139 assert(rURI.startsWith(
"http://") || rURI.startsWith(
"https://"));
141 std::unique_lock aGuard(
m_aMutex );
151 return &it->second.m_sToken;
154 if (it->second.m_Lock.Scope == ucb::LockScope_SHARED && pLock->Scope == ucb::LockScope_EXCLUSIVE)
158 assert(it->second.m_Lock.Type == pLock->Type);
159 if (it->second.m_Lock.Depth < pLock->Depth)
168 return &it->second.m_sToken;
172 ucb::Lock
const& rLock,
173 const OUString& sToken,
175 sal_Int32 nLastChanceToSendRefreshRequest )
177 assert(rURI.startsWith(
"http://") || rURI.startsWith(
"https://"));
179 std::unique_lock aGuard(
m_aMutex );
182 =
LockInfo(sToken, rLock, xSession, nLastChanceToSendRefreshRequest);
191 std::unique_lock aGuard(
m_aMutex );
198 assert(rURI.startsWith(
"http://") || rURI.startsWith(
"https://"));
210 std::unique_lock aGuard(
m_aMutex );
212 ::std::vector<OUString> authFailedLocks;
216 LockInfo & rInfo = rLockInfo.second;
221 osl_getSystemTime( &t1 );
223 <= sal_Int32( t1.Seconds ) )
226 sal_Int32 nlastChanceToSendRefreshRequest = -1;
227 bool isAuthFailed(
false);
229 rLockInfo.first, rLockInfo.second.m_sToken,
230 nlastChanceToSendRefreshRequest,
234 = nlastChanceToSendRefreshRequest;
240 authFailedLocks.push_back(rLockInfo.first);
249 for (
auto const& rLock : authFailedLocks)
void removeLockImpl(std::unique_lock< std::mutex > &rGuard, const OUString &rURI)
rtl::Reference< TickerThread > m_pTickerThread
OUString const * getLockTokenForURI(OUString const &rURI, css::ucb::Lock const *pLock)
void removeLock(const OUString &rURI)
LockInfoMap m_aLockInfoMap
void stopTicker(std::unique_lock< std::mutex > &rGuard)
void addLock(const OUString &rURI, css::ucb::Lock const &rLock, const OUString &sToken, rtl::Reference< CurlSession > const &xSession, sal_Int32 nLastChanceToSendRefreshRequest)
SerfLockStore & m_rLockStore
TickerThread(SerfLockStore &rLockStore)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_INFO(area, stream)
rtl::Reference< CurlSession > m_xSession
sal_Int32 m_nLastChanceToSendRefreshRequest