From 662b635d96300ce7b077e39b5727358bad299eeb Mon Sep 17 00:00:00 2001 From: Andreas Date: Thu, 1 Aug 2013 10:52:01 +0200 Subject: [PATCH] - Do not send cover arts on file download chunks. - Set the version in the send function, not in each function that creates a protocol buffer message. --- src/networkremote/outgoingdatacreator.cpp | 11 ++++------- src/networkremote/remoteclient.cpp | 6 +++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/networkremote/outgoingdatacreator.cpp b/src/networkremote/outgoingdatacreator.cpp index d63232d3d..25d0ab1b5 100644 --- a/src/networkremote/outgoingdatacreator.cpp +++ b/src/networkremote/outgoingdatacreator.cpp @@ -135,9 +135,6 @@ void OutgoingDataCreator::SendDataToClients(pb::remote::Message* msg) { return; } - // Send the default version - msg->set_version(msg->default_instance().version()); - RemoteClient* client; foreach(client, *clients_) { // Do not send data to downloaders @@ -595,11 +592,10 @@ void OutgoingDataCreator::OfferNextSong(RemoteClient *client) { chunk->set_file_count(item.song_count_); chunk->set_file_number(item.song_no_); - CreateSong(item.song_, item.song_.image(), -1, + CreateSong(item.song_, QImage() , -1, chunk->mutable_song_metadata()); } - msg.set_version(msg.default_instance().version()); client->SendData(&msg); } @@ -638,6 +634,8 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song, pb::remote::ResponseSongFileChunk* chunk = msg.mutable_response_song_file_chunk(); msg.set_type(pb::remote::SONG_FILE_CHUNK); + QImage null_image; + while (!file.atEnd()) { // Read file chunk data = file.read(kFileChunkSize); @@ -655,12 +653,11 @@ void OutgoingDataCreator::SendSingleSong(RemoteClient* client, const Song &song, if (chunk_number == 1) { int i = app_->playlist_manager()->active()->current_row(); CreateSong( - song, song.image(), i, + song, null_image, i, msg.mutable_response_song_file_chunk()->mutable_song_metadata()); } // Send data directly to the client - msg.set_version(msg.default_instance().version()); client->SendData(&msg); // Clear working data diff --git a/src/networkremote/remoteclient.cpp b/src/networkremote/remoteclient.cpp index d06afe988..a7da0c360 100644 --- a/src/networkremote/remoteclient.cpp +++ b/src/networkremote/remoteclient.cpp @@ -144,9 +144,6 @@ void RemoteClient::DisconnectClient(pb::remote::ReasonDisconnect reason) { pb::remote::Message msg; msg.set_type(pb::remote::DISCONNECT); - // Send the default version - msg.set_version(msg.default_instance().version()); - msg.mutable_response_disconnect()->set_reason_disconnect(reason); SendDataToClient(&msg); @@ -157,6 +154,9 @@ void RemoteClient::DisconnectClient(pb::remote::ReasonDisconnect reason) { // Sends data to client without check if authenticated void RemoteClient::SendDataToClient(pb::remote::Message *msg) { + // Set the default version + msg->set_version(msg->default_instance().version()); + // Check if we are still connected if (client_->state() == QTcpSocket::ConnectedState) { // Serialize the message