Windows does not have the "unset" command, but this doesn't matter since
the problem that requires us to use unset doesn't happen on Windows.
Also did some minor cosmetic changes, and dependcy changes.
This is more than for cosmetic purposes to match how it's done with autoconf.
Due to the fact that we use environment variables to turn off certain backends during the tests, simply running "ctest" or "make test" can result in failed tests.
This is because if you do "EVENT_NOEPOLL=yes && export EVENT_NOEPOLL" and then run the tests, when running the epoll tests, the EPOLL backend will be turned off. There is no way of unsetting an environment variable for a test in CMake, you can only set them. And since libevent simply checks if the environment variable is set (it doesn't check the actual value of it), this won't work.
So to remedy this, we create the "make verify" target that first unsets all the EVENT_NO* environment variables, and then runs ctest.
Also bumped the required CMake version from 2.6 to 2.8, since the set_test_properties(bla PROPERTIES ENVIRONMENT "SOME_VAR") requires 2.8
Added some explicit dependencies for the test programs to libevent, so they don't just fail if you try to run the tests without first doing "make"
Fix how the CMake project adds the tests using the different backends. At
first we tried to do it exactly as it's done in test/test.sh.
However, test.sh uses a special program test-init to decide if a given
backend is available or not before running the actual tests. Doing it this way
will not be possible using CMake. Since then we would have to have the
test-init executable compiled at the time we run CMake, to know what tests
we should add. (And since CMake generates the make/project files that
compiles the executables, there's a catch 22).
Instead of deciding what tests to run this way, we simply use the result
of the CMake system introspection (that figures out what backends are
available) to decide what backend tests to add.
"flush" can imply writing something out to a file or connection before
clearing it; "clear" always means "remove". It's also potentially
misleading to say "outdated" here, since the function removes _all_
addresses regardless, not just certain outdated ones.
Also, don't free the lock in this function. Also reindent the function.
As mentioned at https://sourceforge.net/p/levent/bugs/293/
created a small function "evdns_base_flush_outdated_host_addresses" which removes all the previous host addresses, if user wants to clean up the list of hosts can call and use this function.
Defination of this function is part of another patch.
As mentioned at https://sourceforge.net/p/levent/bugs/293/
created a small function "evdns_base_flush_outdated_host_addresses" which removes all the previous requests of hosts , if user wants to clean up the list of hosts can call and use this function.
Requires function declaration to be added in include/event2/dns.h
Adding it in another patch for the same bug.
Basically tcp final handshake looks like this:
(C - client, S - server)
ACK[C] - FIN/ACK[S] - FIN/ACK[S] - ACK [C]
However there are servers, that didn't close connection like this,
while it is still _considered_ as valid, and using libevent http layer
we can do requests to such servers.
Modified handshake:
(C - client, S - server)
ACK[C] - RST/ACK[S] - RST/ACK[S]
And in this case we can't extract IP address from socket, because it is
already closed, and getpeername() will return: "transport endpoint is not connected".
So we need to store address that we are connecting to, after we know it,
and that is what this patch do.
I have reproduced it, however it have some extra packages.
(I will try to fix it)
https://github.com/azat/nfq-examples/blob/master/nfqnl_rst_fin.c
Currently an out-of-tree build will either write to the src dir or reuse
the existing regress.gen.[c,h]. But if building from a read-only git
tree (or if the git dir is cleaned), these files will not exist and the
build fails. So write the files to the build dir. If the system does
not have python, the regress.gen.[c,h] will be used from the src dir if
they exist.
The evhttp_send_reply method invokes evhttp_write_buffer with a
callback that may release the underlying request object and
bufferevent upon completion. This cleanup callback is invoked by the
underlying bufferevent's write callback. Improperly enabling write
events before referencing the bufferevent could lead to use after free
and memory corruption.