diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-20 12:46:05 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-07-20 12:46:05 +0200 |
commit | 5c0367fd637606043db41f21444d584c93bee9f0 (patch) | |
tree | 862d3cdce5daaf7a3758f2433297a3a4c5df45ea /synchronizer/listener.cpp | |
parent | 440322eb73a16e2afbe118e457cc0a69aea41e3f (diff) | |
download | sink-5c0367fd637606043db41f21444d584c93bee9f0.tar.gz sink-5c0367fd637606043db41f21444d584c93bee9f0.zip |
Immediately start reading if there is data available
Diffstat (limited to 'synchronizer/listener.cpp')
-rw-r--r-- | synchronizer/listener.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/synchronizer/listener.cpp b/synchronizer/listener.cpp index 36fa6ea..d9ee46d 100644 --- a/synchronizer/listener.cpp +++ b/synchronizer/listener.cpp | |||
@@ -124,6 +124,9 @@ void Listener::acceptConnection() | |||
124 | this, &Listener::clientDropped); | 124 | this, &Listener::clientDropped); |
125 | m_checkConnectionsTimer->stop(); | 125 | m_checkConnectionsTimer->stop(); |
126 | 126 | ||
127 | if (socket->bytesAvailable()) { | ||
128 | readFromSocket(socket); | ||
129 | } | ||
127 | } | 130 | } |
128 | 131 | ||
129 | void Listener::clientDropped() | 132 | void Listener::clientDropped() |
@@ -156,13 +159,17 @@ void Listener::checkConnections() | |||
156 | m_checkConnectionsTimer->start(); | 159 | m_checkConnectionsTimer->start(); |
157 | } | 160 | } |
158 | 161 | ||
159 | void Listener::readFromSocket() | 162 | void Listener::onDataAvailable() |
160 | { | 163 | { |
161 | QLocalSocket *socket = qobject_cast<QLocalSocket *>(sender()); | 164 | QLocalSocket *socket = qobject_cast<QLocalSocket *>(sender()); |
162 | if (!socket) { | 165 | if (!socket) { |
163 | return; | 166 | return; |
164 | } | 167 | } |
168 | readFromSocket(socket); | ||
169 | } | ||
165 | 170 | ||
171 | void Listener::readFromSocket(QLocalSocket *socket) | ||
172 | { | ||
166 | Trace() << "Reading from socket..."; | 173 | Trace() << "Reading from socket..."; |
167 | for (Client &client: m_connections) { | 174 | for (Client &client: m_connections) { |
168 | if (client.socket == socket) { | 175 | if (client.socket == socket) { |