Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/desktop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJocelyn Turcotte <jturcotte@woboq.com>2017-01-11 20:27:22 +0300
committerJocelyn Turcotte <jturcotte@woboq.com>2017-01-18 14:15:52 +0300
commitd3a0608bd543f23c22595aa5844545c352a8dba1 (patch)
treeae3dbe19fc2e1e60cfcc17397c5416c093c35399 /src/gui/socketapi.h
parentc25b599bbba9226870a3ab17be5a01562f8088fb (diff)
SocketAPI: Only push status for files requested by the shell #5361
We currently push the SYNC status for all files that will be propagated, and then the OK status when those files are propagated. On top of this, we send those statuses to all clients connected, even if the socket is kept open by an application that only needed to show a file open dialog. On macOS we're also using an NSConnection which means that we have to wait for the RPC call to return from the extension, which makes bulk status changes possibly heavy. Reduce the time spent needlessly sending status pushes by limiting them to files requested through that socket since it connected. To limit the data to store, only remember the parent directory of files requested, and store those in a bloom filter. Note that this adds a requirement to shell extensions: they should make sure that the status cache only contains entries that have been requested through the socket API. In other words, the status cache must be empty when each socket client connects to the socket API. Otherwise the cached icon type will be shown to the user, and the SocketAPI won't push new status for that file if it didn't receive a RETRIEVE_FILE_STATUS.
Diffstat (limited to 'src/gui/socketapi.h')
-rw-r--r--src/gui/socketapi.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/gui/socketapi.h b/src/gui/socketapi.h
index 2b0aab74c..2c14cff27 100644
--- a/src/gui/socketapi.h
+++ b/src/gui/socketapi.h
@@ -35,6 +35,7 @@ namespace OCC {
class SyncFileStatus;
class Folder;
+class SocketListener;
/**
* @brief The SocketApi class
@@ -60,25 +61,25 @@ signals:
private slots:
void slotNewConnection();
void onLostConnection();
+ void slotSocketDestroyed(QObject* obj);
void slotReadSocket();
- void slotFileStatusChanged(const QString& systemFileName, SyncFileStatus fileStatus);
+ void broadcastStatusPushMessage(const QString& systemPath, SyncFileStatus fileStatus);
private:
- void sendMessage(QIODevice* socket, const QString& message, bool doWait = false);
- void broadcastMessage(const QString& verb, const QString &path, const QString &status = QString::null, bool doWait = false);
+ void broadcastMessage(const QString& msg, bool doWait = false);
- Q_INVOKABLE void command_RETRIEVE_FOLDER_STATUS(const QString& argument, QIODevice* socket);
- Q_INVOKABLE void command_RETRIEVE_FILE_STATUS(const QString& argument, QIODevice* socket);
- Q_INVOKABLE void command_SHARE(const QString& localFile, QIODevice* socket);
+ Q_INVOKABLE void command_RETRIEVE_FOLDER_STATUS(const QString& argument, SocketListener* listener);
+ Q_INVOKABLE void command_RETRIEVE_FILE_STATUS(const QString& argument, SocketListener* listener);
+ Q_INVOKABLE void command_SHARE(const QString& localFile, SocketListener* listener);
- Q_INVOKABLE void command_VERSION(const QString& argument, QIODevice* socket);
+ Q_INVOKABLE void command_VERSION(const QString& argument, SocketListener* listener);
- Q_INVOKABLE void command_SHARE_STATUS(const QString& localFile, QIODevice *socket);
- Q_INVOKABLE void command_SHARE_MENU_TITLE(const QString& argument, QIODevice* socket);
+ Q_INVOKABLE void command_SHARE_STATUS(const QString& localFile, SocketListener* listener);
+ Q_INVOKABLE void command_SHARE_MENU_TITLE(const QString& argument, SocketListener* listener);
QString buildRegisterPathMessage(const QString& path);
QSet<QString> _registeredAliases;
- QList<QIODevice*> _listeners;
+ QList<SocketListener> _listeners;
SocketApiServer _localServer;
};