Author: brane
Date: Wed Jul 16 22:02:25 2025
New Revision: 1927278
URL: http://svn.apache.org/viewvc?rev=1927278&view=rev
Log:
Create the context's pollset just once. It's a cosmetic change.
* src/context.c
(PLATFORM_POLLSET_METHOD): New constant. Define this based on the
BROKEN_WSAPOLL state.
(serf_context_create_ex): Remove the #ifdef when creating the pollset.
Will make it easier to add new flags or error handling or whatnot
in future.
Modified:
serf/trunk/src/context.c
Modified: serf/trunk/src/context.c
URL:
http://svn.apache.org/viewvc/serf/trunk/src/context.c?rev=1927278&r1=1927277&r2=1927278&view=diff
==============================================================================
--- serf/trunk/src/context.c (original)
+++ serf/trunk/src/context.c Wed Jul 16 22:02:25 2025
@@ -136,6 +136,20 @@ void serf_config_authn_types(serf_contex
}
+#ifdef BROKEN_WSAPOLL
+/* APR 1.4.x switched to using WSAPoll() on Win32, but it does not
+ * properly handle errors on a non-blocking sockets (such as
+ * connecting to a server where no listener is active).
+ *
+ * So, sadly, we must force using select() on Win32.
+ *
+ *
http://mail-archives.apache.org/mod_mbox/apr-dev/201105.mbox/%[email protected]%3E
+ */
+#define PLATFORM_POLLSET_METHOD APR_POLLSET_SELECT
+#else
+#define PLATFORM_POLLSET_METHOD APR_POLLSET_DEFAULT
+#endif
+
serf_context_t *serf_context_create_ex(
void *user_baton,
serf_socket_add_t addf,
@@ -160,20 +174,8 @@ serf_context_t *serf_context_create_ex(
### Probably move creation of the pollset to later when we have
### the possibility of returning status to the caller.
*/
-#ifdef BROKEN_WSAPOLL
- /* APR 1.4.x switched to using WSAPoll() on Win32, but it does not
- * properly handle errors on a non-blocking sockets (such as
- * connecting to a server where no listener is active).
- *
- * So, sadly, we must force using select() on Win32.
- *
- *
http://mail-archives.apache.org/mod_mbox/apr-dev/201105.mbox/%[email protected]%3E
- */
(void) apr_pollset_create_ex(&ps->pollset, MAX_CONN, pool, 0,
- APR_POLLSET_SELECT);
-#else
- (void) apr_pollset_create(&ps->pollset, MAX_CONN, pool, 0);
-#endif
+ PLATFORM_POLLSET_METHOD);
ctx->pollset_baton = ps;
ctx->pollset_add = pollset_add;
ctx->pollset_rm = pollset_rm;