summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorFrank Schmirler <vdr@schmirler.de>2011-10-20 23:45:44 +0200
committerFrank Schmirler <vdr@schmirler.de>2011-10-20 23:45:44 +0200
commitbdaea38b863ef7649d7a2253ac937130b6e11d8d (patch)
tree8694c71a1815631fda47ad4f46f32f99301237e0 /server
parent6b633dbfa225847d8d0767c5904884d5218a845e (diff)
downloadvdr-plugin-streamdev-bdaea38b863ef7649d7a2253ac937130b6e11d8d.tar.gz
vdr-plugin-streamdev-bdaea38b863ef7649d7a2253ac937130b6e11d8d.tar.bz2
dropped cServerConnection::m_Pending
Diffstat (limited to 'server')
-rw-r--r--server/connection.c8
-rw-r--r--server/connection.h15
-rw-r--r--server/connectionHTTP.c10
3 files changed, 12 insertions, 21 deletions
diff --git a/server/connection.c b/server/connection.c
index a73470b..64b912c 100644
--- a/server/connection.c
+++ b/server/connection.c
@@ -66,7 +66,6 @@ cServerConnection::cServerConnection(const char *Protocol, int Type):
cTBSocket(Type),
m_Protocol(Protocol),
m_DeferClose(false),
- m_Pending(false),
m_ReadBytes(0),
m_WriteBytes(0),
m_WriteIndex(0)
@@ -196,8 +195,6 @@ bool cServerConnection::Write(void)
if (m_WriteIndex == m_WriteBytes) {
m_WriteIndex = 0;
m_WriteBytes = 0;
- if (m_Pending)
- Command(NULL);
if (m_DeferClose)
return false;
Flushed();
@@ -205,12 +202,12 @@ bool cServerConnection::Write(void)
return true;
}
-bool cServerConnection::Respond(const char *Message, bool Last, ...)
+bool cServerConnection::Respond(const char *Message, ...)
{
char *buffer;
int length;
va_list ap;
- va_start(ap, Last);
+ va_start(ap, Message);
length = vasprintf(&buffer, Message, ap);
va_end(ap);
@@ -233,7 +230,6 @@ bool cServerConnection::Respond(const char *Message, bool Last, ...)
m_WriteBytes += length;
m_WriteBuffer[m_WriteBytes++] = '\015';
m_WriteBuffer[m_WriteBytes++] = '\012';
- m_Pending = !Last;
return true;
}
diff --git a/server/connection.h b/server/connection.h
index 6cc6764..e269ec3 100644
--- a/server/connection.h
+++ b/server/connection.h
@@ -25,7 +25,6 @@ class cServerConnection: public cListObject, public cTBSocket
private:
const char *m_Protocol;
bool m_DeferClose;
- bool m_Pending;
char m_ReadBuffer[MAXPARSEBUFFER];
uint m_ReadBytes;
@@ -53,12 +52,8 @@ protected:
virtual bool Command(char *Cmd) = 0;
/* Will put Message into the response queue, which will be sent in the next
- server cycle. Note that Message will be line-terminated by Respond.
- Only one line at a time may be sent. If there are lines to follow, set
- Last to false. Command(NULL) will be called in the next cycle, so you can
- post the next line. */
- virtual bool Respond(const char *Message, bool Last = true, ...);
- //__attribute__ ((format (printf, 2, 4)));
+ server cycle. Note that Message will be line-terminated by Respond. */
+ virtual bool Respond(const char *Message, ...);
/* Add a request header */
void SetHeader(const char *Name, const char *Value, const char *Prefix = "") { m_Headers.insert(tStrStr(std::string(Prefix) + Name, Value)); }
@@ -87,8 +82,8 @@ public:
virtual bool HasData(void) const;
/* Gets called by server when the socket can accept more data. Writes
- the buffer filled up by Respond(). Calls Command(NULL) if there is a
- command pending. Returns false in case of an error */
+ the buffer filled up by Respond(). Returns false in case of an
+ error */
virtual bool Write(void);
/* Gets called by server when there is incoming data to read. Calls
@@ -128,7 +123,7 @@ public:
inline bool cServerConnection::HasData(void) const
{
- return m_WriteBytes > 0 || m_Pending || m_DeferClose;
+ return m_WriteBytes > 0 || m_DeferClose;
}
#endif // VDR_STREAMDEV_SERVER_CONNECTION_H
diff --git a/server/connectionHTTP.c b/server/connectionHTTP.c
index ffcc924..7dd2d11 100644
--- a/server/connectionHTTP.c
+++ b/server/connectionHTTP.c
@@ -147,7 +147,7 @@ bool cConnectionHTTP::ProcessRequest(void)
esyslog("streamdev-server connectionHTTP: Missing method or pathinfo");
} else if (it_method->second.compare("GET") == 0 && ProcessURI(it_pathinfo->second)) {
if (m_ChannelList)
- return Respond("%s", true, m_ChannelList->HttpHeader().c_str());
+ return Respond("%s", m_ChannelList->HttpHeader().c_str());
else if (m_Channel != NULL) {
cDevice *device = NULL;
if (ProvidesChannel(m_Channel, 0))
@@ -164,7 +164,7 @@ bool cConnectionHTTP::ProcessRequest(void)
} else if (m_StreamType == stES && (m_Apid[0] || m_Dpid[0] || ISRADIO(m_Channel))) {
return Respond("HTTP/1.0 200 OK")
&& Respond("Content-Type: audio/mpeg")
- && Respond("icy-name: %s", true, m_Channel->Name())
+ && Respond("icy-name: %s", m_Channel->Name())
&& Respond("");
} else if (ISRADIO(m_Channel)) {
return Respond("HTTP/1.0 200 OK")
@@ -190,7 +190,7 @@ bool cConnectionHTTP::ProcessRequest(void)
} else if (it_method->second.compare("HEAD") == 0 && ProcessURI(it_pathinfo->second)) {
DeferClose();
if (m_ChannelList)
- return Respond("%s", true, m_ChannelList->HttpHeader().c_str());
+ return Respond("%s", m_ChannelList->HttpHeader().c_str());
else if (m_Channel != NULL) {
if (ProvidesChannel(m_Channel, 0)) {
if (m_StreamType == stEXT) {
@@ -200,7 +200,7 @@ bool cConnectionHTTP::ProcessRequest(void)
} else if (m_StreamType == stES && (m_Apid[0] || m_Dpid[0] || ISRADIO(m_Channel))) {
return Respond("HTTP/1.0 200 OK")
&& Respond("Content-Type: audio/mpeg")
- && Respond("icy-name: %s", true, m_Channel->Name())
+ && Respond("icy-name: %s", m_Channel->Name())
&& Respond("");
} else if (ISRADIO(m_Channel)) {
return Respond("HTTP/1.0 200 OK")
@@ -235,7 +235,7 @@ void cConnectionHTTP::Flushed(void)
if (m_ChannelList) {
if (m_ChannelList->HasNext()) {
- if (!Respond("%s", true, m_ChannelList->Next().c_str()))
+ if (!Respond("%s", m_ChannelList->Next().c_str()))
DeferClose();
}
else {