mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Define symbolic constants to use in place of SHUT_RD etc
This commit is contained in:
parent
e0fd87085d
commit
145f221e8f
6
http.c
6
http.c
@ -976,7 +976,7 @@ evhttp_connection_free(struct evhttp_connection *evcon)
|
||||
bufferevent_free(evcon->bufev);
|
||||
|
||||
if (evcon->fd != -1) {
|
||||
shutdown(evcon->fd, 1);
|
||||
shutdown(evcon->fd, EVUTIL_SHUT_WR);
|
||||
evutil_closesocket(evcon->fd);
|
||||
}
|
||||
|
||||
@ -1043,8 +1043,8 @@ evhttp_connection_reset(struct evhttp_connection *evcon)
|
||||
/* inform interested parties about connection close */
|
||||
if (evhttp_connected(evcon) && evcon->closecb != NULL)
|
||||
(*evcon->closecb)(evcon, evcon->closecb_arg);
|
||||
|
||||
shutdown(evcon->fd, 1);
|
||||
|
||||
shutdown(evcon->fd, EVUTIL_SHUT_WR);
|
||||
evutil_closesocket(evcon->fd);
|
||||
evcon->fd = -1;
|
||||
}
|
||||
|
@ -101,6 +101,23 @@ extern "C" {
|
||||
#define socklen_t _EVENT_socklen_t
|
||||
#endif
|
||||
|
||||
/* Arguments for shutdown() */
|
||||
#ifdef SHUT_RD
|
||||
#define EVUTIL_SHUT_RD SHUT_RD
|
||||
#else
|
||||
#define EVUTIL_SHUT_RD 0
|
||||
#endif
|
||||
#ifdef SHUT_WR
|
||||
#define EVUTIL_SHUT_WR SHUT_WR
|
||||
#else
|
||||
#define EVUTIL_SHUT_WR 1
|
||||
#endif
|
||||
#ifdef SHUT_BOTH
|
||||
#define EVUTIL_SHUT_BOTH SHUT_BOTH
|
||||
#else
|
||||
#define EVUTIL_SHUT_BOTH 2
|
||||
#endif
|
||||
|
||||
/* Locale-independent replacements for some ctypes functions. Use these
|
||||
* when you care about ASCII's notion of character types, because you are about
|
||||
* to send those types onto the wire.
|
||||
|
Loading…
x
Reference in New Issue
Block a user