From 363dee6846bc7fb87db75f8826a7bcf608c83127 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Fri, 30 Jun 2017 09:50:44 +0200 Subject: SVDRP peering can now be limited to the default SVDRP host --- svdrp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'svdrp.c') 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); -- cgit v1.2.3