1
1

send_existing: return after send_existing

When a piece of data is sent from the send_existing() function we must
make the parent function return afterwards. Otherwise we risk that the
parent function tries to send more data and ends up getting an EGAIN for
that more data and since it can only return one return code it doesn't
return info for the successfully sent data.

As this change is a regression I now added a larger comment explaining
why it has to work like this.
Этот коммит содержится в:
Daniel Stenberg 2010-11-13 12:25:06 +01:00
родитель a3ce1073c4
Коммит e87293d480

Просмотреть файл

@ -363,9 +363,9 @@ int _libssh2_transport_read(LIBSSH2_SESSION * session)
PACKETBUFSIZE - remainbuf, -nread);
return LIBSSH2_ERROR_SOCKET_RECV;
}
_libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
"Recved %d/%d bytes to %p+%d", nread,
PACKETBUFSIZE - remainbuf, p->buf, remainbuf);
_libssh2_debug(session, LIBSSH2_TRACE_SOCKET,
"Recved %d/%d bytes to %p+%d", nread,
PACKETBUFSIZE - remainbuf, p->buf, remainbuf);
debugdump(session, "libssh2_transport_read() raw",
&p->buf[remainbuf], nread);
@ -616,7 +616,9 @@ send_existing(LIBSSH2_SESSION *session, const unsigned char *data,
/* the remainder of the package was sent */
p->ototal_num = 0;
p->olen = 0;
*ret = 0; /* don't return */
/* we leave *ret set so that the parent returns as we MUST return back
a send success now, so that we don't risk sending EAGAIN later
which then would confuse the parent function */
return LIBSSH2_ERROR_NONE;
}