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
to be updated to this version.
- Moved handling remote timers into cSVDRPClientHandler::ProcessConnections().
- Combined Start/StopSVDRPServer/ClientHandler() into Start/StopSVDRPHandler().

11
menu.c
View File

@ -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 {
StopSVDRPHandler();
{
LOCK_TIMERS_WRITE;
Timers->SetExplicitModify();
if (Timers->StoreRemoteTimers(NULL, NULL))
Timers->SetModified();
}
StartSVDRPHandler();
}
return state;
}

24
svdrp.c
View File

@ -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) {
if (SVDRPTcpPort) {
if (!SVDRPServerHandler) {
SVDRPServerHandler = new cSVDRPServerHandler(SVDRPTcpPort);
SVDRPServerHandler->Start();
SVDRPServerHandler->WaitUntilReady();
}
}
void StartSVDRPClientHandler(void)
{
cMutexLock MutexLock(&SVDRPHandlerMutex);
if (SVDRPTcpPort && SVDRPUdpPort && !SVDRPClientHandler) {
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)

View File

@ -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

9
vdr.c
View File

@ -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();