diff options
author | sr | 2013-02-05 18:19:31 +0100 |
---|---|---|
committer | sr | 2013-02-05 18:19:31 +0100 |
commit | baca33fe20f12286a4fd3412c616c852d55a3417 (patch) | |
tree | 114bfbf64570f618dfc8d704ca414d958ed23b85 /src | |
parent | [SERVER] Properly tell client the VNC server'S client id (diff) | |
download | pvs2-baca33fe20f12286a4fd3412c616c852d55a3417.tar.gz pvs2-baca33fe20f12286a4fd3412c616c852d55a3417.tar.xz pvs2-baca33fe20f12286a4fd3412c616c852d55a3417.zip |
[SHARED] Add missing error message if network message parsing fails
Diffstat (limited to 'src')
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 9 | ||||
-rw-r--r-- | src/server/net/client.cpp | 2 | ||||
-rw-r--r-- | src/shared/networkmessage.cpp | 3 |
3 files changed, 9 insertions, 5 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 1d9e565..9e89baa 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -724,10 +724,11 @@ void MainWindow::onVncServerStateChange(Client* client) for (QList<ConnectionFrame*>::iterator it(_clientFrames.begin()); it != _clientFrames.end(); ++it) { Client *c = (**it).client(); - if (c == NULL) - continue; // Offline - if (c->id() == client->id() || - (c->desiredProjectionSource() != client->id() && !client->isProjectionSource())) + if (c == NULL || c->id() == client->id()) + continue; // Offline or self + if (c->currentProjectionSource() == client->id()) + continue; // Already watching this client + if (c->desiredProjectionSource() != client->id() && !client->isProjectionSource()) continue; // Not interested c->sendMessage(msg); } diff --git a/src/server/net/client.cpp b/src/server/net/client.cpp index 30e323a..fdabb99 100644 --- a/src/server/net/client.cpp +++ b/src/server/net/client.cpp @@ -143,7 +143,7 @@ void Client::handleMsg() qDebug("Received message with empty ID field. ignored."); return; } - qDebug() << "Received message " << id; + //qDebug() << "Received message " << id; if (_authed == 2) { diff --git a/src/shared/networkmessage.cpp b/src/shared/networkmessage.cpp index f7972f0..5e15f7b 100644 --- a/src/shared/networkmessage.cpp +++ b/src/shared/networkmessage.cpp @@ -113,7 +113,10 @@ bool NetworkMessage::readMessage(QAbstractSocket* socket) const qint64 ret = socket->read(_buffer + _bufferPos, _bufferSize - _bufferPos); //qDebug() << "Read " << ret << " bytes"; if (ret < 0) + { + qDebug("Socket read failed (TCP), return code %d", (int)ret); return false; + } _bufferPos += ret; //qDebug() << "Buffer has now " << _bufferPos << " of " << _bufferSize << " bytes"; } |