If the input is a stream, it will always fail.
From my personal communication, I got this suggestion: using inline incorrectly: see the C99 standard §6.7.4. Please change to static inline (and report upstream). This also caused some clang compilation problem.
One multi_perform() frequently invokes multiple write_cb(). We have to use a dynamic buffer. Hmm.. I really do not like the curl APIs, although I understand why they are designed this way.
In curl/docs/examples/fopen.c, the developer didn't check maxfd set by curl_multi_fdset() and supposed that calling select(0,...) is effectively equivalent to sleep. While the comment is correct, timeout estimated by curl_multi_fdset() is frequently too large - in my case 10 seconds. We seldom need to wait that long. In curl_multi_fdset.3, the cURL developers recommended to wait at least 100ms if maxfd is set to 1. This is what I am doing in the revised code. It does little harm.
sftp connection is really slow. Don't know why.
and also much simpler
* the local array can fit into the global data * sometimes caller needs to know thread id to maintain buffer
the new version is buggy and even if I could fix it, I would not feel confident. Perhaps I will come back later when I am more competent.
kt_for() to be replaced by more complex but more versatile APIs