summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
Diffstat (limited to 'svdrp.c')
-rw-r--r--svdrp.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/svdrp.c b/svdrp.c
index 924acd36..37695758 100644
--- a/svdrp.c
+++ b/svdrp.c
@@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection.
*
- * $Id: svdrp.c 4.21 2017/06/25 12:31:13 kls Exp $
+ * $Id: svdrp.c 4.22 2017/06/30 09:49:39 kls Exp $
*/
#include "svdrp.h"
@@ -549,7 +549,7 @@ cSVDRPClient *cSVDRPClientHandler::GetClientForServer(const char *ServerName)
void cSVDRPClientHandler::SendDiscover(const char *Address)
{
cMutexLock MutexLock(&mutex);
- cString Dgram = cString::sprintf("SVDRP:discover name:%s port:%d vdrversion:%d apiversion:%d timeout:%d", Setup.SVDRPHostName, tcpPort, VDRVERSNUM, APIVERSNUM, Setup.SVDRPTimeout);
+ cString Dgram = cString::sprintf("SVDRP:discover name:%s port:%d vdrversion:%d apiversion:%d timeout:%d%s", Setup.SVDRPHostName, tcpPort, VDRVERSNUM, APIVERSNUM, Setup.SVDRPTimeout, (Setup.SVDRPPeering == spmOnly && *Setup.SVDRPDefaultHost) ? *cString::sprintf(" host:%s", Setup.SVDRPDefaultHost) : "");
udpSocket.SendDgram(Dgram, udpSocket.Port(), Address);
}
@@ -580,6 +580,11 @@ void cSVDRPClientHandler::HandleClientConnection(void)
}
cString ServerName = strgetval(NewDiscover, "name", ':');
if (*ServerName) {
+ if (Setup.SVDRPPeering == spmOnly && strcmp(ServerName, Setup.SVDRPDefaultHost) != 0)
+ return; // we only want to peer with the default host, but this isn't the default host
+ cString HostName = strgetval(NewDiscover, "host", ':');
+ if (*HostName && strcmp(HostName, Setup.SVDRPHostName) != 0)
+ return; // the remote VDR requests a specific host, but it's not us
cString t = strgetval(NewDiscover, "timeout", ':');
if (*t) {
int Timeout = atoi(t);