diff options
| author | kwacker <vdr@w-i-r.com> | 2010-04-11 13:46:11 +0200 |
|---|---|---|
| committer | kwacker <vdr@w-i-r.com> | 2010-04-11 13:46:11 +0200 |
| commit | 9b144d30e0ea8ce900c37b96ba2cbdda14b0ae88 (patch) | |
| tree | 3a52de029f950dcd9f9856a53fd67abef8519e68 /plugins/streamdev/streamdev-cvs/server/component.c | |
| parent | 9cd931834ecadbf5efefdf484abb966e9248ebbb (diff) | |
| download | x-vdr-9b144d30e0ea8ce900c37b96ba2cbdda14b0ae88.tar.gz x-vdr-9b144d30e0ea8ce900c37b96ba2cbdda14b0ae88.tar.bz2 | |
Burn 0.2.0-beta3 und Streamdev mit Paches aktualisiert
Diffstat (limited to 'plugins/streamdev/streamdev-cvs/server/component.c')
| -rw-r--r-- | plugins/streamdev/streamdev-cvs/server/component.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/plugins/streamdev/streamdev-cvs/server/component.c b/plugins/streamdev/streamdev-cvs/server/component.c new file mode 100644 index 0000000..70d861a --- /dev/null +++ b/plugins/streamdev/streamdev-cvs/server/component.c @@ -0,0 +1,49 @@ +/* + * $Id: component.c,v 1.4 2009/02/13 10:39:22 schmirl Exp $ + */ + +#include "server/component.h" +#include "server/connection.h" + +cServerComponent::cServerComponent(const char *Protocol, const char *ListenIp, + uint ListenPort, int Type, int IpProto): + m_Protocol(Protocol), + m_Listen(Type, IpProto), + m_ListenIp(ListenIp), + m_ListenPort(ListenPort) +{ +} + +cServerComponent::~cServerComponent() +{ +} + +bool cServerComponent::Initialize(void) +{ + if (!m_Listen.Listen(m_ListenIp, m_ListenPort, 5)) { + esyslog("Streamdev: Couldn't listen (%s) %s:%d: %m", + m_Protocol, m_ListenIp, m_ListenPort); + return false; + } + isyslog("Streamdev: Listening (%s) on port %d", m_Protocol, m_ListenPort); + return true; +} + +void cServerComponent::Destruct(void) +{ + m_Listen.Close(); +} + +cServerConnection *cServerComponent::Accept(void) +{ + cServerConnection *client = NewClient(); + if (client->Accept(m_Listen)) { + isyslog("Streamdev: Accepted new client (%s) %s:%d", m_Protocol, + client->RemoteIp().c_str(), client->RemotePort()); + return client; + } else { + esyslog("Streamdev: Couldn't accept (%s): %m", m_Protocol); + delete client; + } + return NULL; +} |
