mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Merge remote-tracking branch 'origin/patches-2.0'
This commit is contained in:
commit
4b7baec668
@ -23,7 +23,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
#include "../util-internal.h"
|
||||||
#include "event2/event-config.h"
|
#include "event2/event-config.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -54,24 +54,17 @@ static int was_et = 0;
|
|||||||
static void
|
static void
|
||||||
read_cb(evutil_socket_t fd, short event, void *arg)
|
read_cb(evutil_socket_t fd, short event, void *arg)
|
||||||
{
|
{
|
||||||
// char buf;
|
char buf;
|
||||||
// int len;
|
int len;
|
||||||
|
|
||||||
/* On Linux 3.2.1 (at least, as patched by Fedora and tested by Nick),
|
len = recv(fd, &buf, sizeof(buf), 0);
|
||||||
* doing this "recv" resets the readability of the socket, even though
|
|
||||||
* there is no state change. Yuck! Linux 3.1.9 didn't have this
|
|
||||||
* problem.
|
|
||||||
*/
|
|
||||||
// len = recv(fd, &buf, sizeof(buf), 0);
|
|
||||||
|
|
||||||
called++;
|
called++;
|
||||||
if (event & EV_ET)
|
if (event & EV_ET)
|
||||||
was_et = 1;
|
was_et = 1;
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (!len)
|
if (!len)
|
||||||
event_del(arg);
|
event_del(arg);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef SHUT_WR
|
#ifndef SHUT_WR
|
||||||
@ -93,9 +86,21 @@ test_edgetriggered(void *et)
|
|||||||
evutil_socket_t pair[2] = {-1,-1};
|
evutil_socket_t pair[2] = {-1,-1};
|
||||||
int supports_et;
|
int supports_et;
|
||||||
|
|
||||||
|
/* On Linux 3.2.1 (at least, as patched by Fedora and tested by Nick),
|
||||||
|
* doing a "recv" on an AF_UNIX socket resets the readability of the
|
||||||
|
* socket, even though there is no state change, so we don't actually
|
||||||
|
* get edge-triggered behavior. Yuck! Linux 3.1.9 didn't have this
|
||||||
|
* problem.
|
||||||
|
*/
|
||||||
|
#ifdef __linux__
|
||||||
|
if (evutil_ersatz_socketpair(AF_INET, SOCK_STREAM, 0, pair) == -1) {
|
||||||
|
tt_abort_perror("socketpair");
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (evutil_socketpair(LOCAL_SOCKETPAIR_AF, SOCK_STREAM, 0, pair) == -1) {
|
if (evutil_socketpair(LOCAL_SOCKETPAIR_AF, SOCK_STREAM, 0, pair) == -1) {
|
||||||
tt_abort_perror("socketpair");
|
tt_abort_perror("socketpair");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
called = was_et = 0;
|
called = was_et = 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user