1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Combined Start/StopSVDRPServer/ClientHandler() into Start/StopSVDRPHandler()

This commit is contained in:
Klaus Schmidinger 2018-02-25 13:57:21 +01:00
parent bf497f4aae
commit e4af94d3f9
5 changed files with 31 additions and 46 deletions

View File

@ -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 This change requires that all VDRs that shall take part in a peer-to-peer network need
to be updated to this version. to be updated to this version.
- Moved handling remote timers into cSVDRPClientHandler::ProcessConnections(). - Moved handling remote timers into cSVDRPClientHandler::ProcessConnections().
- Combined Start/StopSVDRPServer/ClientHandler() into Start/StopSVDRPHandler().

21
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "menu.h"
@ -4176,17 +4176,14 @@ eOSState cMenuSetupMisc::ProcessKey(eKeys Key)
if (data.SVDRPPeering != OldSVDRPPeering) if (data.SVDRPPeering != OldSVDRPPeering)
Set(); Set();
if (ModifiedSVDRPSettings) { if (ModifiedSVDRPSettings) {
StopSVDRPClientHandler(); StopSVDRPHandler();
StopSVDRPServerHandler(); {
StartSVDRPServerHandler(); LOCK_TIMERS_WRITE;
if (data.SVDRPPeering) Timers->SetExplicitModify();
StartSVDRPClientHandler(); if (Timers->StoreRemoteTimers(NULL, NULL))
else { Timers->SetModified();
LOCK_TIMERS_WRITE; }
Timers->SetExplicitModify(); StartSVDRPHandler();
if (Timers->StoreRemoteTimers(NULL, NULL))
Timers->SetModified();
}
} }
return state; return state;
} }

38
svdrp.c
View File

@ -10,7 +10,7 @@
* and interact with the Video Disk Recorder - or write a full featured * and interact with the Video Disk Recorder - or write a full featured
* graphical interface that sits on top of an SVDRP connection. * 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" #include "svdrp.h"
@ -2698,37 +2698,29 @@ void cSVDRPServerHandler::Action(void)
static cMutex SVDRPHandlerMutex; static cMutex SVDRPHandlerMutex;
void StartSVDRPServerHandler(void) void StartSVDRPHandler(void)
{ {
cMutexLock MutexLock(&SVDRPHandlerMutex); cMutexLock MutexLock(&SVDRPHandlerMutex);
if (SVDRPTcpPort && !SVDRPServerHandler) { if (SVDRPTcpPort) {
SVDRPServerHandler = new cSVDRPServerHandler(SVDRPTcpPort); if (!SVDRPServerHandler) {
SVDRPServerHandler->Start(); SVDRPServerHandler = new cSVDRPServerHandler(SVDRPTcpPort);
SVDRPServerHandler->WaitUntilReady(); SVDRPServerHandler->Start();
SVDRPServerHandler->WaitUntilReady();
}
if (Setup.SVDRPPeering && SVDRPUdpPort && !SVDRPClientHandler) {
SVDRPClientHandler = new cSVDRPClientHandler(SVDRPTcpPort, SVDRPUdpPort);
SVDRPClientHandler->Start();
}
} }
} }
void StartSVDRPClientHandler(void) void StopSVDRPHandler(void)
{
cMutexLock MutexLock(&SVDRPHandlerMutex);
if (SVDRPTcpPort && SVDRPUdpPort && !SVDRPClientHandler) {
SVDRPClientHandler = new cSVDRPClientHandler(SVDRPTcpPort, SVDRPUdpPort);
SVDRPClientHandler->Start();
}
}
void StopSVDRPServerHandler(void)
{
cMutexLock MutexLock(&SVDRPHandlerMutex);
delete SVDRPServerHandler;
SVDRPServerHandler = NULL;
}
void StopSVDRPClientHandler(void)
{ {
cMutexLock MutexLock(&SVDRPHandlerMutex); cMutexLock MutexLock(&SVDRPHandlerMutex);
delete SVDRPClientHandler; delete SVDRPClientHandler;
SVDRPClientHandler = NULL; SVDRPClientHandler = NULL;
delete SVDRPServerHandler;
SVDRPServerHandler = NULL;
} }
bool GetSVDRPServerNames(cStringList *ServerNames, eSvdrpFetchFlags FetchFlag) bool GetSVDRPServerNames(cStringList *ServerNames, eSvdrpFetchFlags FetchFlag)

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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 #ifndef __SVDRP_H
@ -25,10 +25,8 @@ enum eSvdrpFetchFlags {
void SetSVDRPPorts(int TcpPort, int UdpPort); void SetSVDRPPorts(int TcpPort, int UdpPort);
void SetSVDRPGrabImageDir(const char *GrabImageDir); void SetSVDRPGrabImageDir(const char *GrabImageDir);
void StartSVDRPServerHandler(void); void StartSVDRPHandler(void);
void StartSVDRPClientHandler(void); void StopSVDRPHandler(void);
void StopSVDRPServerHandler(void);
void StopSVDRPClientHandler(void);
bool GetSVDRPServerNames(cStringList *ServerNames, eSvdrpFetchFlags FetchFlag = sffNone); bool GetSVDRPServerNames(cStringList *ServerNames, eSvdrpFetchFlags FetchFlag = sffNone);
///< Gets a list of all available VDRs this VDR is connected to via SVDRP, ///< 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 ///< and stores it in the given ServerNames list. The list is cleared

9
vdr.c
View File

@ -22,7 +22,7 @@
* *
* The project's page is at http://www.tvdr.de * 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> #include <getopt.h>
@ -946,9 +946,7 @@ int main(int argc, char *argv[])
// SVDRP: // SVDRP:
SetSVDRPPorts(SVDRPport, DEFAULTSVDRPPORT); SetSVDRPPorts(SVDRPport, DEFAULTSVDRPPORT);
StartSVDRPServerHandler(); StartSVDRPHandler();
if (Setup.SVDRPPeering)
StartSVDRPClientHandler();
// Main program loop: // Main program loop:
@ -1562,8 +1560,7 @@ Exit:
signal(SIGPIPE, SIG_DFL); signal(SIGPIPE, SIG_DFL);
signal(SIGALRM, SIG_DFL); signal(SIGALRM, SIG_DFL);
StopSVDRPClientHandler(); StopSVDRPHandler();
StopSVDRPServerHandler();
ChannelCamRelations.Save(); ChannelCamRelations.Save();
cRecordControls::Shutdown(); cRecordControls::Shutdown();
PluginManager.StopPlugins(); PluginManager.StopPlugins();