Fix test compilation with nmake: add the gdi.lib dependency

ACK: efekty
Missed lock acquire/release in event_base_cancel_single_callback_()

Call backtrace:
...
event_queue_remove_active()
event_callback_cancel_nolock_()
event_base_cancel_single_callback_()
event_base_free_()
event_base_free()
...

Fix for e9ebef83
Whoops. It is gdi.lib, not gdi32.lib. (github issue #61)
Fix SEGFAULT after evdns_base_resume if no nameservers installed.

If there is no nameservers installed, using
evdns_base_nameserver_ip_add(), than evdns_base_resume() will SEGFAULT,
because of NULL dereference in evdns_requests_pump_waiting_queue()
Add tests for evdns_base_resume().

- leak_resume
- leak_cancel_and_resume
- leak_resume_send_err
- leak_cancel_and_resume_send_err
Fix dns/leak_resume_send_err test.

Because we don't cancel request,
and want our callback to recieve DNS_ERR_SHUTDOWN,
we use deferred callback, and there was
- one extra malloc(),
  @see reply_schedule_callback()
- and one missing free
  @see request_finished() (req->handle->pending_cb = 1)
than we don't need to count in testleak_cleanup()

So just decrement allocated_chunks to 2,
like we already take care about it.
If evsel->del() fails, don't leave the evmap in an inconsistent state.

 This fixes assertion failures in cases where epoll() fails with EBADF
 -- the root cause for which is as of yet unknown. It seems something
 (OpenSSL?) is closing the file descriptor under our feet.
Avoid redundant syscall to make a nonblocking socket nonblocking
Avoid redundant syscall if making a socket cloexec twice

I got the idea from Maxime's last patch.
Fix a double close() bug in evhttp when the underlying bufferevent uses BEV_OPT_CLOSE_ON_FREE.
Fix locking in bufferevent_get_options_().
Remove a debugging assert that should not have been left in
Merge remote-tracking branch 'origin/pr/62'
Use windows vsnprintf fixup logic on all windows environments

Previously I'd relied on mingw to provide a vsnprintf with a
conformant return value.  But it appears that some mingw
environments don't do that.
Merge remote-tracking branch 'origin/patches-2.0'
Merge remote-tracking branch 'libevent/master'