View | Details | Raw Unified | Return to bug 39329
Collapse All | Expand All

(-)modules/database/mod_dbd.c.orig (-16 / +18 lines)
Lines 337-359 Link Here
337
            return NULL;
337
            return NULL;
338
        }
338
        }
339
    }
339
    }
340
    if (apr_reslist_acquire(svr->dbpool, &rec) != APR_SUCCESS) {
340
341
        ap_log_perror(APLOG_MARK, APLOG_ERR, 0, pool,
341
    /* try our best to fetch a valid connection */
342
                      "Failed to acquire DBD connection from pool!");
342
    while (apr_reslist_acquire(svr->dbpool, &rec) == APR_SUCCESS) {
343
        return NULL;
343
        rv = apr_dbd_check_conn(arec->driver, pool, arec->handle);
344
    }
344
        if ((rv != APR_SUCCESS) && (rv != APR_ENOTIMPL)) {
345
    rv = apr_dbd_check_conn(arec->driver, pool, arec->handle);
345
            errmsg = apr_dbd_error(arec->driver, arec->handle, rv);
346
    if ((rv != APR_SUCCESS) && (rv != APR_ENOTIMPL)) {
346
            if (!errmsg) {
347
        errmsg = apr_dbd_error(arec->driver, arec->handle, rv);
347
                errmsg = "(unknown)";
348
        if (!errmsg) {
348
            }
349
            errmsg = "(unknown)";
349
            ap_log_perror(APLOG_MARK, APLOG_ERR, 0, pool,
350
        }
350
                          "DBD[%s] Error: %s", svr->name, errmsg );
351
        ap_log_perror(APLOG_MARK, APLOG_ERR, 0, pool,
351
            apr_reslist_invalidate(svr->dbpool, rec);
352
                      "DBD[%s] Error: %s", svr->name, errmsg );
352
        } else {
353
        apr_reslist_invalidate(svr->dbpool, rec);
353
            return arec;
354
        return NULL;
354
        }
355
    }
355
    }
356
    return arec;
356
    ap_log_perror(APLOG_MARK, APLOG_ERR, 0, pool,
357
                  "Failed to acquire DBD connection from pool!");
358
    return NULL;
357
}
359
}
358
#else
360
#else
359
AP_DECLARE(ap_dbd_t*) ap_dbd_open(apr_pool_t *pool, server_rec *s)
361
AP_DECLARE(ap_dbd_t*) ap_dbd_open(apr_pool_t *pool, server_rec *s)

Return to bug 39329