Archived
1
0

write correct amount

This commit is contained in:
Jeff Becker 2018-05-06 11:03:53 -04:00
parent e5c8ea84d0
commit fd1c4ccb12
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05

View File

@ -97,7 +97,7 @@ bool IServerConn::keepalive() { return !m_handler->ShouldClose(); }
int IServerConn::write(size_t avail) int IServerConn::write(size_t avail)
{ {
auto leftovers = m_writeLeftover.size(); auto leftovers = m_writeLeftover.size();
ssize_t written; int written = 0;
if (leftovers) if (leftovers)
{ {
if (leftovers > avail) if (leftovers > avail)
@ -136,6 +136,7 @@ int IServerConn::write(size_t avail)
if (wrote > 0) if (wrote > 0)
{ {
written += wrote; written += wrote;
avail -= wrote;
m_writeLeftover = line.substr(wrote); m_writeLeftover = line.substr(wrote);
} }
else else