This PR calls evhttp_free
before releasing event base. But according to evhttp_free
docs:
Works only if no requests are currently being served.
So this PR also tracks active requests with libevent and waits for last request to finish. This requires libevent 2.1 due to evhttp_request_set_on_complete_cb
(https://github.com/libevent/libevent/blob/master/whatsnew-2.1.txt).
Finally, the call to evhttp_free
is done in the event base loop to avoid concurrency issues.
Now test/functional/feature_abortnode.py quits normally, not due to socket timeouts.