Define symbolic constants to use in place of SHUT_RD etc

This commit is contained in:
Nick Mathewson 2010-10-05 13:06:32 -04:00
parent e0fd87085d
commit 145f221e8f
2 changed files with 20 additions and 3 deletions

6
http.c
View File

@ -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;
}

View File

@ -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.