- 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.
This commit is contained in:
Andreas 2013-08-01 10:52:01 +02:00
parent 4fe293b6d0
commit 662b635d96
2 changed files with 7 additions and 10 deletions

View File

@ -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

View File

@ -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