Author: brane
Date: Wed Jul 16 21:51:42 2025
New Revision: 1927277

URL: http://svn.apache.org/viewvc?rev=1927277&view=rev
Log:
Don't ignore errors when creating the context's guard mutex for
the acync resolver's result list.

* serf_private.h
  (serf_context_t::resolve_guard_status): New member.
* src/context.c
  (serf_context_create_ex): Recort the status from creating the mutex
   in the context.
* src/resolve.c
  (serf_address_resolve_async): Fail immediately if the guard mutex
   in the context could not be created.

Modified:
    serf/trunk/serf_private.h
    serf/trunk/src/context.c
    serf/trunk/src/resolve.c

Modified: serf/trunk/serf_private.h
URL: 
http://svn.apache.org/viewvc/serf/trunk/serf_private.h?rev=1927277&r1=1927276&r2=1927277&view=diff
==============================================================================
--- serf/trunk/serf_private.h (original)
+++ serf/trunk/serf_private.h Wed Jul 16 21:51:42 2025
@@ -501,6 +501,7 @@ struct serf_context_t {
     /* The results of asynchronous address resolution. */
 #if APR_HAS_THREADS
     apr_thread_mutex_t *resolve_guard;
+    apr_status_t resolve_guard_status;
 #endif
     serf__resolve_result_t *resolve_head;
 };

Modified: serf/trunk/src/context.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/src/context.c?rev=1927277&r1=1927276&r2=1927277&view=diff
==============================================================================
--- serf/trunk/src/context.c (original)
+++ serf/trunk/src/context.c Wed Jul 16 21:51:42 2025
@@ -194,10 +194,11 @@ serf_context_t *serf_context_create_ex(
 
     /* Initialize async resolver result queue. */
 #if APR_HAS_THREADS
-    /* FIXME: Ignore the status? */
-    apr_thread_mutex_create(&ctx->resolve_guard,
-                            APR_THREAD_MUTEX_DEFAULT,
-                            ctx->pool);
+    ctx->resolve_guard_status = apr_thread_mutex_create(
+        &ctx->resolve_guard, APR_THREAD_MUTEX_DEFAULT, ctx->pool);
+    if (ctx->resolve_guard_status != APR_SUCCESS) {
+        ctx->resolve_guard = NULL;
+    }
 #endif
     ctx->resolve_head = NULL;
 

Modified: serf/trunk/src/resolve.c
URL: 
http://svn.apache.org/viewvc/serf/trunk/src/resolve.c?rev=1927277&r1=1927276&r2=1927277&view=diff
==============================================================================
--- serf/trunk/src/resolve.c (original)
+++ serf/trunk/src/resolve.c Wed Jul 16 21:51:42 2025
@@ -79,6 +79,12 @@ apr_status_t serf_address_resolve_async(
 {
     apr_pool_t *resolve_pool;
 
+#if APR_HAS_THREADS
+    if (ctx->resolve_guard_status != APR_SUCCESS) {
+        return ctx->resolve_guard_status;
+    }
+#endif
+
     apr_pool_create(&resolve_pool, ctx->pool);
 
     /* See serf_connection_create3(): if there's a proxy configured in the


Reply via email to