Skip to content

Conversation

uudiin
Copy link
Contributor

@uudiin uudiin commented Sep 27, 2016

No description provided.

@coveralls
Copy link

coveralls commented Sep 27, 2016

Coverage Status

Coverage decreased (-0.03%) to 63.667% when pulling 5b296d1 on uudiin:master into 90c1777 on Lua-cURL:master.

@moteus
Copy link
Member

moteus commented Sep 27, 2016

Can you provide test case?

@moteus
Copy link
Member

moteus commented Sep 27, 2016

I see what your problem. Thanks for bug report.
But I am not sure how to properly fix it.
I can not find any documentation about when cURL may call callbacks.
I thouth it can call callbacks only during perform and socket_action calls.
But I found that timerfunction can be called during add_handle call.
So now question is can cURL call any easy callbacks in such cases and shuld I set
Lua state only for multi handle or for all easy also?

multi = curl.multi{
  timerfunction = on_curl_timeout;
  socketfunction = on_curl_action;
}

-- here cURL may call e.g. `timerfunction` .
coroutine.wrap(function() multi:add_handle(c) end)()

PS. It will be good if you have any simple testcase without any external deps.

@uudiin
Copy link
Contributor Author

uudiin commented Sep 27, 2016

I will provide testcase later. it depend on libuv and luv(lua libuv)
it is a example based multi-uv.c in curl source tree (curl/docs/examples/multi-uv.c)

@moteus
Copy link
Member

moteus commented Sep 27, 2016

I know about this :). And I use this example to test on local machine.
But I think how easily run this on Appveyor.

@coveralls
Copy link

coveralls commented Sep 27, 2016

Coverage Status

Coverage decreased (-0.03%) to 63.667% when pulling 209585a on uudiin:master into 90c1777 on Lua-cURL:master.

@moteus
Copy link
Member

moteus commented Sep 27, 2016

I have similar example uvwget
I make my PR wich fix this bug. But it also works with coroutines.
Can you test it?

@moteus moteus added the bug label Sep 27, 2016
end

wget.data = {}
easy:setopt_writefunction(function(ud, s)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to notice. you can use just easy:setopt_writefunction(table.insert, wget.data)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I got it

@moteus moteus closed this in #80 Sep 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants