Client did not reconnect properly to server when server app restarts.

When Read() on the command channel failed, the buffer size was not
trimmed. Read() was never called again as the buffer appeared to be full. Fixes #322 reported by alexw.
This commit is contained in:
schmirl 2007-07-20 06:54:03 +00:00
parent e9bd0c96f3
commit c8bf0474f9

View File

@ -140,8 +140,10 @@ ssize_t cTBSource::ReadUntil(void *Buffer, size_t Length, const char *Seq,
len = m_LineBuffer.size(); len = m_LineBuffer.size();
m_LineBuffer.resize(BUFSIZ); m_LineBuffer.resize(BUFSIZ);
if ((b = Read((char*)m_LineBuffer.data() + len, BUFSIZ - len)) == -1) if ((b = Read((char*)m_LineBuffer.data() + len, BUFSIZ - len)) == -1) {
m_LineBuffer.resize(len);
return -1; return -1;
}
m_LineBuffer.resize(len + b); m_LineBuffer.resize(len + b);
if ((len = m_LineBuffer.find(Seq)) != (size_t)-1) { if ((len = m_LineBuffer.find(Seq)) != (size_t)-1) {