@@ -706,25 +706,13 @@ static size_t rpc_out(void *ptr, size_t eltsize,
* we need to refrain from reading.
*/
}
- if (rpc->flush_read_but_not_sent) {
- if (!avail) {
- /*
- * The line length either does not need to be sent at
- * all or has already been completely sent. Now we can
- * return 0, indicating EOF, meaning that the flush has
- * been fully sent. It is important to keep returning 0
- * as long as needed in that case, as libcurl invokes
- * the callback multiple times at EOF sometimes.
- */
- return 0;
- }
- /*
- * If avail is non-zero, the line length for the flush still
- * hasn't been fully sent. Proceed with sending the line
- * length.
- */
- }
+ /*
+ * Copy data to the provided buffer. If there is nothing more to send,
+ * nothing gets written and the return value is 0 (EOF).
+ * It is important to keep returning 0 as long as needed in that case,
+ * as libcurl invokes the callback multiple times at EOF sometimes.
+ */
if (max < avail)
avail = max;
memcpy(ptr, rpc->buf + rpc->pos, avail);
Remove the second set of nested `if` statements and an early `return` in `rpc_out()`, because they accomplish nothing. The rest of the function would behave the same without any branching. Signed-off-by: Jiri Hruska <jirka@fud.cz> --- remote-curl.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-)