diff --git a/pjlib/include/pj/config.h b/pjlib/include/pj/config.h index fc08ed746..bce870de0 100644 --- a/pjlib/include/pj/config.h +++ b/pjlib/include/pj/config.h @@ -487,11 +487,7 @@ * the underlying implementation changes. */ #ifndef PJ_IOQUEUE_MAX_HANDLES -# if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0 -# define PJ_IOQUEUE_MAX_HANDLES (64) -# else -# define PJ_IOQUEUE_MAX_HANDLES (256) -# endif +# define PJ_IOQUEUE_MAX_HANDLES (64) #endif @@ -532,22 +528,22 @@ /** * Determine if FD_SETSIZE is changeable/set-able. If so, then we will - * set it to PJ_IOQUEUE_MAX_HANDLES. + * set it to PJ_IOQUEUE_MAX_HANDLES. Currently we detect this by checking + * for Winsock. */ -/* This is awful, as we should actually check for __GLIBC__ rather than - * __GNUC__. But alas! Libc headers are not included yet at this stage. - */ -#ifdef __GNUC__ -# define PJ_FD_SETSIZE_SETABLE 0 -#else -# define PJ_FD_SETSIZE_SETABLE 1 +#ifndef PJ_FD_SETSIZE_SETABLE +# if defined(PJ_HAS_WINSOCK_H) && PJ_HAS_WINSOCK_H!=0 +# define PJ_FD_SETSIZE_SETABLE 1 +# else +# define PJ_FD_SETSIZE_SETABLE 0 +# endif #endif /** * Overrides FD_SETSIZE so it is consistent throughout the library. - * We only do this if we detected that FD_SETSIZE is changeable. - * - * Default: #PJ_IOQUEUE_MAX_HANDLES + * We only do this if we detected that FD_SETSIZE is changeable. If + * FD_SETSIZE is not set-able, then PJ_IOQUEUE_MAX_HANDLES must be + * set to value lower than FD_SETSIZE. */ #if PJ_FD_SETSIZE_SETABLE /* Only override FD_SETSIZE if the value has not been set */ diff --git a/pjlib/src/pj/ioqueue_select.c b/pjlib/src/pj/ioqueue_select.c index 4bf114713..7738f6685 100644 --- a/pjlib/src/pj/ioqueue_select.c +++ b/pjlib/src/pj/ioqueue_select.c @@ -38,6 +38,14 @@ #include #include +/* Now that we have access to OS'es , lets check again that + * PJ_IOQUEUE_MAX_HANDLES is not greater than FD_SETSIZE + */ +#if PJ_IOQUEUE_MAX_HANDLES > FD_SETSIZE +# error "PJ_IOQUEUE_MAX_HANDLES cannot be greater than FD_SETSIZE" +#endif + + /* * Include declaration from common abstraction. */ diff --git a/pjlib/src/pj/sock_select.c b/pjlib/src/pj/sock_select.c index b3743b936..566050ef2 100644 --- a/pjlib/src/pj/sock_select.c +++ b/pjlib/src/pj/sock_select.c @@ -35,13 +35,6 @@ # pragma warning(disable: 4389) // Signed/unsigned mismatch in FD_* #endif -/* Now that we have access to OS'es , lets check again that - * PJ_IOQUEUE_MAX_HANDLES is not greater than FD_SETSIZE - */ -#if PJ_IOQUEUE_MAX_HANDLES > FD_SETSIZE -# error "PJ_IOQUEUE_MAX_HANDLES cannot be greater than FD_SETSIZE" -#endif - #define PART_FDSET(ps) ((fd_set*)&ps->data[1]) #define PART_FDSET_OR_NULL(ps) (ps ? PART_FDSET(ps) : NULL) #define PART_COUNT(ps) (ps->data[0])