summaryrefslogtreecommitdiff
path: root/server/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/connection.c')
-rw-r--r--server/connection.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/server/connection.c b/server/connection.c
index 64b912c..a73470b 100644
--- a/server/connection.c
+++ b/server/connection.c
@@ -66,6 +66,7 @@ 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)
@@ -195,6 +196,8 @@ 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();
@@ -202,12 +205,12 @@ bool cServerConnection::Write(void)
return true;
}
-bool cServerConnection::Respond(const char *Message, ...)
+bool cServerConnection::Respond(const char *Message, bool Last, ...)
{
char *buffer;
int length;
va_list ap;
- va_start(ap, Message);
+ va_start(ap, Last);
length = vasprintf(&buffer, Message, ap);
va_end(ap);
@@ -230,6 +233,7 @@ bool cServerConnection::Respond(const char *Message, ...)
m_WriteBytes += length;
m_WriteBuffer[m_WriteBytes++] = '\015';
m_WriteBuffer[m_WriteBytes++] = '\012';
+ m_Pending = !Last;
return true;
}