You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bn...@apache.org on 2004/05/26 00:29:33 UTC
cvs commit: apr/test testpoll.c
bnicholes 2004/05/25 15:29:33
Modified: test testpoll.c
Log:
A timeout value of 0 causes select() on NetWare to return immediately with a timeout error. So give NetWare a little time.
Revision Changes Path
1.32 +12 -7 apr/test/testpoll.c
Index: testpoll.c
===================================================================
RCS file: /home/cvs/apr/test/testpoll.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- testpoll.c 14 May 2004 14:43:22 -0000 1.31
+++ testpoll.c 25 May 2004 22:29:33 -0000 1.32
@@ -27,6 +27,11 @@
* 64, the test will fail even though the code is correct.
*/
#define LARGE_NUM_SOCKETS 50
+#ifdef NETWARE
+#define SOCK_TIMEOUT 1000
+#else
+#define SOCK_TIMEOUT 0
+#endif
static apr_socket_t *s[LARGE_NUM_SOCKETS];
static apr_sockaddr_t *sa[LARGE_NUM_SOCKETS];
@@ -314,7 +319,7 @@
int lrv;
const apr_pollfd_t *descs = NULL;
- rv = apr_pollset_poll(pollset, 0, &lrv, &descs);
+ rv = apr_pollset_poll(pollset, SOCK_TIMEOUT, &lrv, &descs);
ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));
ABTS_INT_EQUAL(tc, 0, lrv);
ABTS_PTR_EQUAL(tc, NULL, descs);
@@ -327,7 +332,7 @@
int num;
send_msg(s, sa, 0, tc);
- rv = apr_pollset_poll(pollset, 0, &num, &descs);
+ rv = apr_pollset_poll(pollset, SOCK_TIMEOUT, &num, &descs);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_INT_EQUAL(tc, 1, num);
ABTS_PTR_NOTNULL(tc, descs);
@@ -343,7 +348,7 @@
const apr_pollfd_t *descs = NULL;
recv_msg(s, 0, p, tc);
- rv = apr_pollset_poll(pollset, 0, &lrv, &descs);
+ rv = apr_pollset_poll(pollset, SOCK_TIMEOUT, &lrv, &descs);
ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));
ABTS_INT_EQUAL(tc, 0, lrv);
ABTS_PTR_EQUAL(tc, NULL, descs);
@@ -357,7 +362,7 @@
send_msg(s, sa, 2, tc);
send_msg(s, sa, 5, tc);
- rv = apr_pollset_poll(pollset, 0, &num, &descs);
+ rv = apr_pollset_poll(pollset, SOCK_TIMEOUT, &num, &descs);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_INT_EQUAL(tc, 2, num);
ABTS_PTR_NOTNULL(tc, descs);
@@ -376,7 +381,7 @@
recv_msg(s, 2, p, tc);
recv_msg(s, 5, p, tc);
- rv = apr_pollset_poll(pollset, 0, &lrv, &descs);
+ rv = apr_pollset_poll(pollset, SOCK_TIMEOUT, &lrv, &descs);
ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));
ABTS_INT_EQUAL(tc, 0, lrv);
ABTS_PTR_EQUAL(tc, NULL, descs);
@@ -389,7 +394,7 @@
int num;
send_msg(s, sa, LARGE_NUM_SOCKETS - 1, tc);
- rv = apr_pollset_poll(pollset, 0, &num, &descs);
+ rv = apr_pollset_poll(pollset, SOCK_TIMEOUT, &num, &descs);
ABTS_INT_EQUAL(tc, APR_SUCCESS, rv);
ABTS_INT_EQUAL(tc, 1, num);
ABTS_PTR_NOTNULL(tc, descs);
@@ -406,7 +411,7 @@
recv_msg(s, LARGE_NUM_SOCKETS - 1, p, tc);
- rv = apr_pollset_poll(pollset, 0, &lrv, &descs);
+ rv = apr_pollset_poll(pollset, SOCK_TIMEOUT, &lrv, &descs);
ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv));
ABTS_INT_EQUAL(tc, 0, lrv);
ABTS_PTR_EQUAL(tc, NULL, descs);
Re: cvs commit: apr/test testpoll.c
Posted by Joe Orton <jo...@manyfish.co.uk>.
On Tue, May 25, 2004 at 10:29:33PM -0000, Brad Nicholes wrote:
> bnicholes 2004/05/25 15:29:33
>
> A timeout value of 0 causes select() on NetWare to return
> immediately with a timeout error. So give NetWare a little time.
...
Well, that's hiding a real problem then. Passing select() a zeroed
timeout structure has well-defined behaviour on Unix.
So either this needs to be fixed in the APR port to NetWare, or it needs
to be documented in the API as undefined behaviour, and the test suite
shouldn't test for it.
> --- testpoll.c 14 May 2004 14:43:22 -0000 1.31
> +++ testpoll.c 25 May 2004 22:29:33 -0000 1.32
> @@ -27,6 +27,11 @@
> * 64, the test will fail even though the code is correct.
> */
> #define LARGE_NUM_SOCKETS 50
> +#ifdef NETWARE
> +#define SOCK_TIMEOUT 1000
> +#else
> +#define SOCK_TIMEOUT 0
> +#endif
>
> static apr_socket_t *s[LARGE_NUM_SOCKETS];
> static apr_sockaddr_t *sa[LARGE_NUM_SOCKETS];
> @@ -314,7 +319,7 @@
> int lrv;
> const apr_pollfd_t *descs = NULL;
>
> - rv = apr_pollset_poll(pollset, 0, &lrv, &descs);
> + rv = apr_pollset_poll(pollset, SOCK_TIMEOUT, &lrv, &descs);
Re: cvs commit: apr/test testpoll.c
Posted by rb...@rkbloom.net.
On 25 May 2004 bnicholes@apache.org wrote:
> bnicholes 2004/05/25 15:29:33
>
> Modified: test testpoll.c
> Log:
> A timeout value of 0 causes select() on NetWare to return immediately with a timeout error. So give NetWare a little time.
This isn't the right fix. Select should be returning immediately in these
tests. Are you saying that timeout == 0 makes NetWare not check the
results? This should be fixed in the Netware port of APR, not in the test
code.
Ryan
Re: cvs commit: apr/test testpoll.c
Posted by rb...@rkbloom.net.
On 25 May 2004 bnicholes@apache.org wrote:
> bnicholes 2004/05/25 15:29:33
>
> Modified: test testpoll.c
> Log:
> A timeout value of 0 causes select() on NetWare to return immediately with a timeout error. So give NetWare a little time.
This isn't the right fix. Select should be returning immediately in these
tests. Are you saying that timeout == 0 makes NetWare not check the
results? This should be fixed in the Netware port of APR, not in the test
code.
Ryan