blob: 7c72444e48237f9947cd39312aeddb9988b72e57 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/*
* VdrmonThread
*/
#include <string.h>
#include <vdr/plugin.h>
#include <vdr/thread.h>
#include "vdrmanagerthread.h"
#include "select.h"
#include "helpers.h"
cAndroVdrThread::cAndroVdrThread(int port, const char * password, bool forceCheckSvdrp)
{
select = NULL;
this->port = port;
this->password = password;
this->forceCheckSvdrp = forceCheckSvdrp;
}
cAndroVdrThread::~cAndroVdrThread()
{
Cleanup();
}
void cAndroVdrThread::Action(void)
{
// create listener socket
if (!Init())
return;
// do processing
select->Action();
// cleanup
Cleanup();
}
bool cAndroVdrThread::Init()
{
// create select
select = new cSelect();
if (select == NULL)
return false;
// create server socket
cVdrmanagerServerSocket * sock = new cVdrmanagerServerSocket();
if (sock == NULL || !sock->Create(port, password, forceCheckSvdrp))
return false;
// register server socket
select->SetServerSocket(sock);
return true;
}
void cAndroVdrThread::Cleanup()
{
if (select)
delete select;
}
void cAndroVdrThread::Shutdown()
{
}
|