nextcloud-desktop/shell_integration/windows/OCUtil/RemotePathChecker.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

239 lines
8.3 KiB
C++
Raw Normal View History

2014-07-30 19:20:55 +04:00
/**
* Copyright (c) 2014 ownCloud GmbH. All rights reserved.
2014-07-30 19:20:55 +04:00
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; version 2.1 of the License
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
#include "stdafx.h"
2014-07-30 19:20:55 +04:00
#include "CommunicationSocket.h"
#include "RemotePathChecker.h"
#include "StringUtil.h"
2014-07-30 19:20:55 +04:00
#include <shlobj.h>
2014-07-30 19:20:55 +04:00
#include <algorithm>
#include <iostream>
#include <sstream>
#include <iterator>
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
#include <unordered_set>
#include <cassert>
#include <shlobj.h>
2014-07-30 19:20:55 +04:00
using namespace std;
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
// This code is run in a thread
void RemotePathChecker::workerThreadLoop()
2014-07-30 19:20:55 +04:00
{
auto pipename = CommunicationSocket::DefaultPipePath();
bool connected = false;
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
CommunicationSocket socket;
std::unordered_set<std::wstring> asked;
while(!_stop) {
Sleep(50);
if (!connected) {
asked.clear();
if (!WaitNamedPipe(pipename.data(), 100)) {
continue;
}
if (!socket.Connect(pipename)) {
continue;
}
connected = true;
std::unique_lock<std::mutex> lock(_mutex);
_connected = true;
}
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
{
std::unique_lock<std::mutex> lock(_mutex);
while (!_pending.empty() && !_stop) {
auto filePath = _pending.front();
_pending.pop();
lock.unlock();
if (!asked.count(filePath)) {
asked.insert(filePath);
socket.SendMsg(wstring(L"RETRIEVE_FILE_STATUS:" + filePath + L'\n').data());
}
lock.lock();
}
}
std::wstring response;
while (!_stop && socket.ReadLine(&response)) {
if (StringUtil::begins_with(response, wstring(L"REGISTER_PATH:"))) {
wstring responsePath = response.substr(14); // length of REGISTER_PATH:
auto sharedPtrCopy = atomic_load(&_watchedDirectories);
auto vectorCopy = make_shared<vector<wstring>>(*sharedPtrCopy);
vectorCopy->push_back(responsePath);
atomic_store(&_watchedDirectories, shared_ptr<const vector<wstring>>(vectorCopy));
// We don't keep track of all files and can't know which file is currently visible
// to the user, but at least reload the root dir so that any shortcut to the root
// is updated without the user needing to refresh.
SHChangeNotify(SHCNE_UPDATEDIR, SHCNF_PATH | SHCNF_FLUSHNOWAIT, responsePath.data(), NULL);
} else if (StringUtil::begins_with(response, wstring(L"UNREGISTER_PATH:"))) {
wstring responsePath = response.substr(16); // length of UNREGISTER_PATH:
auto sharedPtrCopy = atomic_load(&_watchedDirectories);
auto vectorCopy = make_shared<vector<wstring>>(*sharedPtrCopy);
vectorCopy->erase(
std::remove(vectorCopy->begin(), vectorCopy->end(), responsePath),
vectorCopy->end());
atomic_store(&_watchedDirectories, shared_ptr<const vector<wstring>>(vectorCopy));
vector<wstring> removedPaths;
{ std::unique_lock<std::mutex> lock(_mutex);
// Remove any item from the cache
for (auto it = _cache.begin(); it != _cache.end() ; ) {
if (StringUtil::isDescendantOf(it->first, responsePath)) {
removedPaths.emplace_back(move(it->first));
it = _cache.erase(it);
} else {
++it;
}
}
}
for (auto& path : removedPaths)
SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, path.data(), NULL);
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
} else if (StringUtil::begins_with(response, wstring(L"STATUS:")) ||
StringUtil::begins_with(response, wstring(L"BROADCAST:"))) {
wstring responseStatus, responsePath;
if (!StringUtil::extractChunks(response, responseStatus, responsePath))
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
continue;
auto state = _StrToFileState(responseStatus);
bool wasAsked = asked.erase(responsePath) > 0;
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
bool updateView = false;
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
{ std::unique_lock<std::mutex> lock(_mutex);
auto it = _cache.find(responsePath);
if (it == _cache.end()) {
// The client only approximates requested files, if the bloom
// filter becomes saturated after navigating multiple directories we'll start getting
// status pushes that we never requested and fill our cache. Ignore those.
if (!wasAsked) {
continue;
}
it = _cache.insert(make_pair(responsePath, StateNone)).first;
}
updateView = it->second != state;
it->second = state;
}
if (updateView) {
SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, responsePath.data(), NULL);
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
}
}
}
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
if (socket.Event() == INVALID_HANDLE_VALUE) {
atomic_store(&_watchedDirectories, make_shared<const vector<wstring>>());
std::unique_lock<std::mutex> lock(_mutex);
_connected = connected = false;
// Swap to make a copy of the cache under the mutex and clear the one stored.
std::unordered_map<std::wstring, FileState> cache;
swap(cache, _cache);
lock.unlock();
// Let explorer know about each invalidated cache entry that needs to get its icon removed.
for (auto it = cache.begin(); it != cache.end(); ++it) {
SHChangeNotify(SHCNE_UPDATEITEM, SHCNF_PATH | SHCNF_FLUSHNOWAIT, it->first.data(), NULL);
}
}
if (_stop) return;
HANDLE handles[2] = { _newQueries, socket.Event() };
WaitForMultipleObjects(2, handles, false, 0);
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
}
2014-07-30 19:20:55 +04:00
}
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
RemotePathChecker::RemotePathChecker()
: _stop(false)
, _watchedDirectories(make_shared<const vector<wstring>>())
, _connected(false)
, _newQueries(CreateEvent(NULL, FALSE, FALSE, NULL))
, _thread([this]{ this->workerThreadLoop(); })
{
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
}
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
RemotePathChecker::~RemotePathChecker()
{
_stop = true;
//_newQueries.notify_all();
SetEvent(_newQueries);
_thread.join();
CloseHandle(_newQueries);
}
std::shared_ptr<const std::vector<std::wstring>> RemotePathChecker::WatchedDirectories() const
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
{
return atomic_load(&_watchedDirectories);
}
2014-08-04 17:40:08 +04:00
bool RemotePathChecker::IsMonitoredPath(const wchar_t* filePath, int* state)
2014-07-30 19:20:55 +04:00
{
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
assert(state); assert(filePath);
2014-07-30 19:20:55 +04:00
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
std::unique_lock<std::mutex> lock(_mutex);
if (!_connected) {
return false;
}
2014-07-30 19:20:55 +04:00
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
auto path = std::wstring(filePath);
auto it = _cache.find(path);
if (it != _cache.end()) {
// The path is in our cache, and we'll get updates pushed if the status changes.
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
*state = it->second;
return true;
}
_pending.push(filePath);
lock.unlock();
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
SetEvent(_newQueries);
return false;
2014-07-30 19:20:55 +04:00
}
Windows Shell Integration: Use the QLocalSocket on windo and do the request assynchroniously Squashed commit of the following: commit 4d9b072f560fa171a1390b7c74425614aa20e955 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 16:04:02 2014 +0200 Remove useless variable commit 8e85de0307ec5f31bf3f92a7de793fed7d41c2ea Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 16:01:52 2014 +0200 Make Windows Explorer Extension build commit 8e2942cd9fd32e3af72d60cba0d06bd9d6222a45 Author: Daniel Molkentin <danimo@owncloud.com> Date: Tue Oct 14 11:39:37 2014 +0200 Fix compilation commit 0fc0c0e0e0c7e58ad97f62700256c7d1f8c0670b Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:48:32 2014 +0200 Windows Shell Integration: Try to let the thread notify about changes when there are changes commit 4a1712b7c03269ca3007f167b8f313ea47655967 Author: Olivier Goffart <ogoffart@woboq.com> Date: Tue Oct 14 11:35:20 2014 +0200 Windows Shell Integration: Share the RemotePathChecker amongst all the OCOverlay instances commit 2d87408e9af5a4d7ab71c460ce606ba1f367c09f Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 18:55:15 2014 +0200 Windows Shell Integration: Attempts to wait on multiple objects (WIP) commit e448e427b6d1561ad7a40d08fc6632f4d2b4ef44 Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 17:58:02 2014 +0200 Introduce a worker thread commit 2344407ec0bc1ce173ebbacadcf3992d62d94078 Author: Olivier Goffart <ogoffart@woboq.com> Date: Mon Oct 13 17:03:47 2014 +0200 Windows Shell Integration: try to keep the socket open using a thread (WIP) commit ea6d5273ed60d8bc3f1c5d5c6936364d783a1c0f Author: Daniel Molkentin <danimo@owncloud.com> Date: Mon Oct 13 15:27:46 2014 +0200 Make Explorer plugin work again with named pipes This is a temporary hack, which needs more refactoring. commit 44a3437a44082379efa0078c9afd7b8bbde930de Author: Daniel Molkentin <danimo@owncloud.com> Date: Sat Oct 11 07:31:24 2014 +0200 Fix code commit 123390a0f3516c0078309d7048c6d2acb9293676 Author: Olivier Goffart <ogoffart@woboq.com> Date: Fri Oct 10 16:29:35 2014 +0200 Windows shell integration: Use named pipe (WIP) commit 9eea7e2321abeac6b8db0bd85bfce612dbf6bb20 Author: Olivier Goffart <ogoffart@woboq.com> Date: Wed Oct 1 12:04:13 2014 +0200 Windows Shell Integration: Simplify StringUtil This fixes a memory leak in CommunicationSocket::ReadLine
2014-10-14 18:05:48 +04:00
RemotePathChecker::FileState RemotePathChecker::_StrToFileState(const std::wstring &str)
2014-07-30 19:20:55 +04:00
{
if (str == L"NOP" || str == L"NONE") {
return StateNone;
} else if (str == L"SYNC" || str == L"NEW") {
return StateSync;
} else if (str == L"SYNC+SWM" || str == L"NEW+SWM") {
return StateSync;
} else if (str == L"OK") {
return StateOk;
} else if (str == L"OK+SWM") {
return StateOkSWM;
} else if (str == L"IGNORE") {
return StateWarning;
} else if (str == L"IGNORE+SWM") {
return StateWarning;
} else if (str == L"ERROR") {
return StateError;
} else if (str == L"ERROR+SWM") {
return StateError;
}
return StateNone;
}