write correct amount
This commit is contained in:
parent
e5c8ea84d0
commit
fd1c4ccb12
@ -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
|
||||||
|
Reference in New Issue
Block a user