From 6b63ad145fbdbb6ff9e066a196863c0527d44fa1 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Mon, 16 Feb 2015 19:42:18 +0200 Subject: [PATCH] Fixed the frontend assignment. --- server.c | 6 +++--- server.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server.c b/server.c index 3d79e36..d3f6c67 100644 --- a/server.c +++ b/server.c @@ -31,7 +31,7 @@ cSatipFrontend::~cSatipFrontend() bool cSatipFrontends::Matches(int deviceIdP, int transponderP) { for (cSatipFrontend *f = First(); f; f = Next(f)) { - if (f->Attached() && (f->Transponder() == transponderP)) + if (f->Attached() && (f->DeviceId() == deviceIdP) && (f->Transponder() == transponderP)) return true; } return false; @@ -39,10 +39,10 @@ bool cSatipFrontends::Matches(int deviceIdP, int transponderP) bool cSatipFrontends::Assign(int deviceIdP, int transponderP) { - cSatipFrontend *tmp = First(); + cSatipFrontend *tmp = NULL; // Prefer any unused one for (cSatipFrontend *f = First(); f; f = Next(f)) { - if (!f->Attached()) { + if (!f->Attached() || (f->DeviceId() == deviceIdP)) { tmp = f; break; } diff --git a/server.h b/server.h index 59f003d..45bb1df 100644 --- a/server.h +++ b/server.h @@ -28,6 +28,7 @@ public: bool Attached(void) { return (deviceIdM >= 0); } int Index(void) { return indexM; } int Transponder(void) { return transponderM; } + int DeviceId(void) { return deviceIdM; } void SetTransponder(int transponderP) { transponderM = transponderP; } };