/
wvdbusd.cc
49 lines (42 loc) · 954 Bytes
/
wvdbusd.cc
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
#include "wvdbusserver.h"
#include "wvlogstream.h"
#include "wvassert.h"
#include "wvlinkerhack.h"
WV_LINK_TO(WvSSLStream);
WV_LINK_TO(WvTCPListener);
WV_LINK_TO(WvGzipStream);
#ifndef __WIN32
WV_LINK_TO(WvUnixListener);
#endif
static WvLogStream *logr;
static WvDBusServer *s;
extern "C" void wvdbusd_start()
{
wvassert(!s);
wverr->addRef();
logr = new WvLogStream(wverr, WvLog::Info);
s = new WvDBusServer();
}
extern "C" void wvdbusd_stop()
{
WVRELEASE(s);
delete logr;
s = NULL;
logr = NULL;
}
extern "C" void wvdbusd_listen(const char *moniker)
{
s->listen(moniker);
}
extern "C" void wvdbusd_runonce()
{
// FIXME: Should use runonce(-1) here, but then the .net thread we
// run in won't be able to get interrupted to check want_to_die.
// Ideally we'd hand them a socket or something that they can ping us
// with.
s->runonce(1000);
}
extern "C" int wvdbusd_check()
{
return 42;
}