fix some bugs in AsyncSSLSocketTest
Summary:
A couple of the test functions in AsyncSSLSocketTest maintained two EventBase
objects and alternated looping between them. In some cases it would call
EventBase::loopOnce() even when there was no work to do. This call normally
blocks until an event is ready. This happened to work when using libevent1,
but this appears mostly accidental: with libevent1 EVLOOP_ONCE causes the loop
to break out even after an "internal" I/O event; in libevent2 EVLOOP_ONCE only
breaks out after a non-internal event has occurred:
https://github.com/libevent/libevent/commit/
0617a818204397790e5e4c9bcb9e91ae5ea7817a
In these tests it turns out that the internal EventBase NotificationQueue
always gets triggered the very first time loopOnce() is called, preventing
these tests from hanging when using libevent1.
This fixes the hang when using libevent2 by removing the initial loopOnce()
calls that potentially have nothing to do. This also consolidates the 2
EventBase objects into one to avoid having to alternate loopOnce() calls
between them without knowing which one actually has work to do.
This also fixes an issue where the code never checked the return value of
`recv()`
Reviewed By: yfeldblum, siyengar
Differential Revision:
D6735669
fbshipit-source-id:
5f36106a08866aa8908e82263f83a606399cdf79