summaryrefslogtreecommitdiff
path: root/svdrp.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2017-06-30 09:50:44 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2017-06-30 09:50:44 +0200
commit363dee6846bc7fb87db75f8826a7bcf608c83127 (patch)
tree1730f5070fccac36acf0eb6559ac16e232bffb2b /svdrp.c
parenta28d92d0490e75f2be7d7239ac491683e215c42f (diff)
downloadvdr-363dee6846bc7fb87db75f8826a7bcf608c83127.tar.gz
vdr-363dee6846bc7fb87db75f8826a7bcf608c83127.tar.bz2
SVDRP peering can now be limited to the default SVDRP host2.3.8
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);