- Check if Queue is empty before sending next song.

- Changed the way the queue is deleted after client disconnects.
This commit is contained in:
Andreas 2013-07-18 12:14:00 +02:00
parent 66eff922d8
commit d1da0159e2
1 changed files with 4 additions and 2 deletions

View File

@ -145,8 +145,7 @@ void OutgoingDataCreator::SendDataToClients(pb::remote::Message* msg) {
if (client->State() != QTcpSocket::ConnectedState) {
clients_->removeAt(clients_->indexOf(client));
if (download_queue_.contains(client)) {
delete download_queue_.value(client);
download_queue_.remove(client);
delete download_queue_.take(client);
}
delete client;
}
@ -584,6 +583,9 @@ void OutgoingDataCreator::SendNextSong(RemoteClient *client) {
if (!download_queue_.contains(client))
return;
if (download_queue_.value(client)->isEmpty())
return;
// Get the item and send the single song
DownloadItem item;
item = download_queue_.value(client)->dequeue();