diff options
Diffstat (limited to 'server/connection.h')
-rw-r--r-- | server/connection.h | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/server/connection.h b/server/connection.h index e269ec3..6cc6764 100644 --- a/server/connection.h +++ b/server/connection.h @@ -25,6 +25,7 @@ class cServerConnection: public cListObject, public cTBSocket private: const char *m_Protocol; bool m_DeferClose; + bool m_Pending; char m_ReadBuffer[MAXPARSEBUFFER]; uint m_ReadBytes; @@ -52,8 +53,12 @@ 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. */ - virtual bool Respond(const char *Message, ...); + 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))); /* Add a request header */ void SetHeader(const char *Name, const char *Value, const char *Prefix = "") { m_Headers.insert(tStrStr(std::string(Prefix) + Name, Value)); } @@ -82,8 +87,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(). Returns false in case of an - error */ + the buffer filled up by Respond(). Calls Command(NULL) if there is a + command pending. Returns false in case of an error */ virtual bool Write(void); /* Gets called by server when there is incoming data to read. Calls @@ -123,7 +128,7 @@ public: inline bool cServerConnection::HasData(void) const { - return m_WriteBytes > 0 || m_DeferClose; + return m_WriteBytes > 0 || m_Pending || m_DeferClose; } #endif // VDR_STREAMDEV_SERVER_CONNECTION_H |