summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2018-02-25 13:57:21 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2018-02-25 13:57:21 +0100
commite4af94d3f938fdbae91d010c8120794d4558b83f (patch)
tree6e72ae339ed3c97b73b0bef7c3b353e16b6c0b93
parentbf497f4aae5f78076a24ed4d9c0a79c2f824d63b (diff)
downloadvdr-e4af94d3f938fdbae91d010c8120794d4558b83f.tar.gz
vdr-e4af94d3f938fdbae91d010c8120794d4558b83f.tar.bz2
Combined Start/StopSVDRPServer/ClientHandler() into Start/StopSVDRPHandler()
-rw-r--r--HISTORY1
-rw-r--r--menu.c21
-rw-r--r--svdrp.c38
-rw-r--r--svdrp.h8
-rw-r--r--vdr.c9
5 files changed, 31 insertions, 46 deletions
diff --git a/HISTORY b/HISTORY
index 2721c151..1aea16d8 100644
--- a/HISTORY
+++ b/HISTORY
@@ -9284,3 +9284,4 @@ Video Disk Recorder Revision History
This change requires that all VDRs that shall take part in a peer-to-peer network need
to be updated to this version.
- Moved handling remote timers into cSVDRPClientHandler::ProcessConnections().
+- Combined Start/StopSVDRPServer/ClientHandler() into Start/StopSVDRPHandler().
diff --git a/menu.c b/menu.c
index c5020e6b..b12a31e9 100644
--- a/menu.c
+++ b/menu.c
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: menu.c 4.63 2018/02/25 13:28:19 kls Exp $
+ * $Id: menu.c 4.64 2018/02/25 13:54:57 kls Exp $
*/
#include "menu.h"
@@ -4176,17 +4176,14 @@ eOSState cMenuSetupMisc::ProcessKey(eKeys Key)
if (data.SVDRPPeering != OldSVDRPPeering)
Set();
if (ModifiedSVDRPSettings) {
- StopSVDRPClientHandler();
- StopSVDRPServerHandler();
- StartSVDRPServerHandler();
- if (data.SVDRPPeering)
- StartSVDRPClientHandler();
- else {
- LOCK_TIMERS_WRITE;
- Timers->SetExplicitModify();
- if (Timers->StoreRemoteTimers(NULL, NULL))
- Timers->SetModified();
- }
+ StopSVDRPHandler();
+ {
+ LOCK_TIMERS_WRITE;
+ Timers->SetExplicitModify();
+ if (Timers->StoreRemoteTimers(NULL, NULL))
+ Timers->SetModified();
+ }
+ StartSVDRPHandler();
}
return state;
}
diff --git a/svdrp.c b/svdrp.c
index 48df03ca..6f8e9d2a 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.28 2018/02/25 13:26:17 kls Exp $
+ * $Id: svdrp.c 4.29 2018/02/25 13:44:54 kls Exp $
*/
#include "svdrp.h"
@@ -2698,37 +2698,29 @@ void cSVDRPServerHandler::Action(void)
static cMutex SVDRPHandlerMutex;
-void StartSVDRPServerHandler(void)
+void StartSVDRPHandler(void)
{
cMutexLock MutexLock(&SVDRPHandlerMutex);
- if (SVDRPTcpPort && !SVDRPServerHandler) {
- SVDRPServerHandler = new cSVDRPServerHandler(SVDRPTcpPort);
- SVDRPServerHandler->Start();
- SVDRPServerHandler->WaitUntilReady();
- }
-}
-
-void StartSVDRPClientHandler(void)
-{
- cMutexLock MutexLock(&SVDRPHandlerMutex);
- if (SVDRPTcpPort && SVDRPUdpPort && !SVDRPClientHandler) {
- SVDRPClientHandler = new cSVDRPClientHandler(SVDRPTcpPort, SVDRPUdpPort);
- SVDRPClientHandler->Start();
+ if (SVDRPTcpPort) {
+ if (!SVDRPServerHandler) {
+ SVDRPServerHandler = new cSVDRPServerHandler(SVDRPTcpPort);
+ SVDRPServerHandler->Start();
+ SVDRPServerHandler->WaitUntilReady();
+ }
+ if (Setup.SVDRPPeering && SVDRPUdpPort && !SVDRPClientHandler) {
+ SVDRPClientHandler = new cSVDRPClientHandler(SVDRPTcpPort, SVDRPUdpPort);
+ SVDRPClientHandler->Start();
+ }
}
}
-void StopSVDRPServerHandler(void)
-{
- cMutexLock MutexLock(&SVDRPHandlerMutex);
- delete SVDRPServerHandler;
- SVDRPServerHandler = NULL;
-}
-
-void StopSVDRPClientHandler(void)
+void StopSVDRPHandler(void)
{
cMutexLock MutexLock(&SVDRPHandlerMutex);
delete SVDRPClientHandler;
SVDRPClientHandler = NULL;
+ delete SVDRPServerHandler;
+ SVDRPServerHandler = NULL;
}
bool GetSVDRPServerNames(cStringList *ServerNames, eSvdrpFetchFlags FetchFlag)
diff --git a/svdrp.h b/svdrp.h
index f1ae922a..6973ddd0 100644
--- a/svdrp.h
+++ b/svdrp.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: svdrp.h 4.8 2018/02/19 12:36:35 kls Exp $
+ * $Id: svdrp.h 4.9 2018/02/25 13:38:59 kls Exp $
*/
#ifndef __SVDRP_H
@@ -25,10 +25,8 @@ enum eSvdrpFetchFlags {
void SetSVDRPPorts(int TcpPort, int UdpPort);
void SetSVDRPGrabImageDir(const char *GrabImageDir);
-void StartSVDRPServerHandler(void);
-void StartSVDRPClientHandler(void);
-void StopSVDRPServerHandler(void);
-void StopSVDRPClientHandler(void);
+void StartSVDRPHandler(void);
+void StopSVDRPHandler(void);
bool GetSVDRPServerNames(cStringList *ServerNames, eSvdrpFetchFlags FetchFlag = sffNone);
///< Gets a list of all available VDRs this VDR is connected to via SVDRP,
///< and stores it in the given ServerNames list. The list is cleared
diff --git a/vdr.c b/vdr.c
index 1e012a2e..54207ce1 100644
--- a/vdr.c
+++ b/vdr.c
@@ -22,7 +22,7 @@
*
* The project's page is at http://www.tvdr.de
*
- * $Id: vdr.c 4.22 2018/02/25 13:07:09 kls Exp $
+ * $Id: vdr.c 4.23 2018/02/25 13:45:24 kls Exp $
*/
#include <getopt.h>
@@ -946,9 +946,7 @@ int main(int argc, char *argv[])
// SVDRP:
SetSVDRPPorts(SVDRPport, DEFAULTSVDRPPORT);
- StartSVDRPServerHandler();
- if (Setup.SVDRPPeering)
- StartSVDRPClientHandler();
+ StartSVDRPHandler();
// Main program loop:
@@ -1562,8 +1560,7 @@ Exit:
signal(SIGPIPE, SIG_DFL);
signal(SIGALRM, SIG_DFL);
- StopSVDRPClientHandler();
- StopSVDRPServerHandler();
+ StopSVDRPHandler();
ChannelCamRelations.Save();
cRecordControls::Shutdown();
PluginManager.StopPlugins();