summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/ucp/webdav-curl/CurlSession.cxx17
-rw-r--r--ucb/source/ucp/webdav-curl/CurlSession.hxx4
-rw-r--r--ucb/source/ucp/webdav-curl/SerfLockStore.cxx19
3 files changed, 35 insertions, 5 deletions
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.cxx b/ucb/source/ucp/webdav-curl/CurlSession.cxx
index 3fe73b57f873..4c42985190ff 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.cxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.cxx
@@ -2064,7 +2064,8 @@ auto CurlSession::UNLOCK(OUString const& rURIReference, DAVRequestEnvironment co
}
auto CurlSession::NonInteractive_LOCK(OUString const& rURI,
- sal_Int32& o_rLastChanceToSendRefreshRequest) -> bool
+ sal_Int32& o_rLastChanceToSendRefreshRequest,
+ bool& o_rIsAuthFailed) -> bool
{
SAL_INFO("ucb.ucp.webdav.curl", "NonInteractive_LOCK: " << rURI);
@@ -2097,6 +2098,20 @@ auto CurlSession::NonInteractive_LOCK(OUString const& rURI,
SAL_INFO("ucb.ucp.webdav.curl", "NonInteractive_LOCK succeeded on " << rURI);
return true;
}
+ catch (DAVException const& rException)
+ {
+ SAL_INFO("ucb.ucp.webdav.curl", "NonInteractive_LOCK failed on " << rURI);
+ switch (rException.getError())
+ {
+ case DAVException::DAV_HTTP_AUTH:
+ case DAVException::DAV_HTTP_NOAUTH:
+ o_rIsAuthFailed = true;
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
catch (...)
{
SAL_INFO("ucb.ucp.webdav.curl", "NonInteractive_LOCK failed on " << rURI);
diff --git a/ucb/source/ucp/webdav-curl/CurlSession.hxx b/ucb/source/ucp/webdav-curl/CurlSession.hxx
index 88496308a947..33288b312051 100644
--- a/ucb/source/ucp/webdav-curl/CurlSession.hxx
+++ b/ucb/source/ucp/webdav-curl/CurlSession.hxx
@@ -127,8 +127,8 @@ public:
virtual auto abort() -> void override;
- auto NonInteractive_LOCK(OUString const& rURI, sal_Int32& o_rLastChanceToSendRefreshRequest)
- -> bool;
+ auto NonInteractive_LOCK(OUString const& rURI, sal_Int32& o_rLastChanceToSendRefreshRequest,
+ bool& o_rIsAuthFailed) -> bool;
auto NonInteractive_UNLOCK(OUString const& rURI) -> void;
};
diff --git a/ucb/source/ucp/webdav-curl/SerfLockStore.cxx b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
index 93cca865eb1b..ef9534dbe58f 100644
--- a/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
+++ b/ucb/source/ucp/webdav-curl/SerfLockStore.cxx
@@ -135,8 +135,10 @@ void SerfLockStore::stopTicker(osl::ClearableMutexGuard & rGuard)
rGuard.clear();
- if (pTickerThread.is())
+ if (pTickerThread.is() && pTickerThread->getIdentifier() != osl::Thread::getCurrentIdentifier())
+ {
pTickerThread->join(); // without m_aMutex locked (to prevent deadlock)
+ }
}
OUString SerfLockStore::getLockToken(const OUString& rURI)
@@ -238,6 +240,8 @@ void SerfLockStore::refreshLocks()
{
osl::MutexGuard aGuard( m_aMutex );
+ ::std::vector<OUString> authFailedLocks;
+
for ( auto& rLockInfo : m_aLockInfoMap )
{
LockInfo & rInfo = rLockInfo.second;
@@ -251,20 +255,31 @@ void SerfLockStore::refreshLocks()
{
// refresh the lock.
sal_Int32 nlastChanceToSendRefreshRequest = -1;
+ bool isAuthFailed(false);
if (rInfo.m_xSession->NonInteractive_LOCK(
- rLockInfo.first, nlastChanceToSendRefreshRequest))
+ rLockInfo.first, nlastChanceToSendRefreshRequest,
+ isAuthFailed))
{
rInfo.m_nLastChanceToSendRefreshRequest
= nlastChanceToSendRefreshRequest;
}
else
{
+ if (isAuthFailed)
+ {
+ authFailedLocks.push_back(rLockInfo.first);
+ }
// refresh failed. stop auto-refresh.
rInfo.m_nLastChanceToSendRefreshRequest = -1;
}
}
}
}
+
+ for (auto const& rLock : authFailedLocks)
+ {
+ removeLock(rLock);
+ }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */