mirror of
https://github.com/apache/httpd.git
synced 2025-08-08 15:02:10 +03:00
Cleanup alternate is_connected method.
It works for sure on win32,linux and solaris. I do not have access to other platforms so can not verify it works on them. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@451896 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -2074,7 +2074,10 @@ ap_proxy_determine_connection(apr_pool_t *p, request_rec *r,
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WIN32) || defined(LINUX)
|
#if defined(WIN32) || defined(LINUX) || defined(SOLARIS2)
|
||||||
|
/* Tested platforms on which the alternative is_connected
|
||||||
|
* method works.
|
||||||
|
*/
|
||||||
#define USE_ALTERNATE_IS_CONNECTED 1
|
#define USE_ALTERNATE_IS_CONNECTED 1
|
||||||
#else
|
#else
|
||||||
#define USE_ALTERNATE_IS_CONNECTED 0
|
#define USE_ALTERNATE_IS_CONNECTED 0
|
||||||
@@ -2101,9 +2104,9 @@ static int is_socket_connected(apr_socket_t *socket)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
rc = select((int)sock + 1, &fd, NULL, NULL, &tv);
|
rc = select((int)sock + 1, &fd, NULL, NULL, &tv);
|
||||||
#if defined(WIN32) || (defined(NETWARE) && defined(__NOVELL_LIBC__))
|
#ifdef _MSC_VER
|
||||||
errno = WSAGetLastError() - WSABASEERR;
|
errno = WSAGetLastError() - WSABASEERR;
|
||||||
#endif
|
#endif
|
||||||
} while (rc == -1 && errno == EINTR);
|
} while (rc == -1 && errno == EINTR);
|
||||||
|
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
@@ -2111,22 +2114,17 @@ static int is_socket_connected(apr_socket_t *socket)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else if (rc == 1) {
|
else if (rc == 1) {
|
||||||
#if defined(WIN32) || (defined(NETWARE) && defined(__NOVELL_LIBC__))
|
#ifdef _MSC_VER
|
||||||
u_long nr;
|
u_long nr;
|
||||||
if (ioctlsocket(sock, FIONREAD, &nr) == 0) {
|
if (ioctlsocket(sock, FIONREAD, &nr) == 0) {
|
||||||
if (WSAGetLastError() == 0)
|
|
||||||
errno = 0;
|
|
||||||
else
|
|
||||||
errno = WSAGetLastError() - WSABASEERR;
|
|
||||||
return nr == 0 ? 0 : 1;
|
return nr == 0 ? 0 : 1;
|
||||||
}
|
}
|
||||||
errno = WSAGetLastError() - WSABASEERR;
|
|
||||||
#else
|
#else
|
||||||
int nr;
|
int nr;
|
||||||
if (ioctl(sock, FIONREAD, (void*)&nr) == 0) {
|
if (ioctl(sock, FIONREAD, (void*)&nr) == 0) {
|
||||||
return nr == 0 ? 0 : 1;
|
return nr == 0 ? 0 : 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user