From 91bff75503c9ed6d8803e91ebd149cf3ce66a1df Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Wed, 8 Jul 2020 10:31:41 +0300
Subject: [PATCH] Fix no immediate channel select bug

---
 components/streams/src/netstream.cpp | 8 +++-----
 components/streams/src/stream.cpp    | 6 +++---
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/components/streams/src/netstream.cpp b/components/streams/src/netstream.cpp
index aa0dc042b..105152c14 100644
--- a/components/streams/src/netstream.cpp
+++ b/components/streams/src/netstream.cpp
@@ -163,6 +163,7 @@ bool Net::begin() {
 				last_frame_ = spkt.timestamp;
 
 				if (size() > 0) {
+					// TODO: For all framesets
 					auto sel = selected(0);
 
 					// A change in channel selections, so send those requests now
@@ -170,10 +171,8 @@ bool Net::begin() {
 						auto changed = sel - last_selected_;
 						last_selected_ = sel;
 
-						if (size() > 0) {
-							for (auto c : changed) {
-								_sendRequest(c, kAllFramesets, kAllFrames, 30, 0);
-							}
+						for (auto c : changed) {
+							_sendRequest(c, kAllFramesets, kAllFrames, 30, 0);
 						}
 					}
 				}
@@ -185,7 +184,6 @@ bool Net::begin() {
 						const auto &sel = selected(0);
 						
 						for (auto c : sel) {
-							LOG(INFO) << "DO I SEND REQ";
 							_sendRequest(c, kAllFramesets, kAllFrames, 30, 0);
 						}
 					}
diff --git a/components/streams/src/stream.cpp b/components/streams/src/stream.cpp
index a4a273ce4..28538ba85 100644
--- a/components/streams/src/stream.cpp
+++ b/components/streams/src/stream.cpp
@@ -25,11 +25,11 @@ std::unordered_set<ftl::codecs::Channel> operator-(const std::unordered_set<ftl:
 }
 
 bool operator!=(const std::unordered_set<ftl::codecs::Channel> &a, const std::unordered_set<ftl::codecs::Channel> &b) {
-	if (a.size() != b.size()) return false;
+	if (a.size() != b.size()) return true;
 	for (auto &i : a) {
-		if (b.find(i) == b.end()) return false;
+		if (b.find(i) == b.end()) return true;
 	}
-	return true;
+	return false;
 }
 
 const std::unordered_set<ftl::codecs::Channel> &Stream::available(int fs) const {
-- 
GitLab