summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/c/cgi.c3
-rw-r--r--src/c/fastcgi.c3
-rw-r--r--src/c/http.c3
-rw-r--r--src/c/urweb.c7
4 files changed, 7 insertions, 9 deletions
diff --git a/src/c/cgi.c b/src/c/cgi.c
index 52d122ca..6d6e5252 100644
--- a/src/c/cgi.c
+++ b/src/c/cgi.c
@@ -131,8 +131,7 @@ void uw_do_expunge(uw_context ctx, uw_Basis_client cli, void *data) {
if (uw_get_app(ctx)->db_begin(ctx))
uw_error(ctx, FATAL, "Error running SQL BEGIN");
uw_get_app(ctx)->expunger(ctx, cli);
- if (uw_get_app(ctx)->db_commit(ctx))
- uw_error(ctx, FATAL, "Error running SQL COMMIT");
+ uw_commit(ctx);
}
void uw_post_expunge(uw_context ctx, void *data) {
diff --git a/src/c/fastcgi.c b/src/c/fastcgi.c
index dcfdec78..34042262 100644
--- a/src/c/fastcgi.c
+++ b/src/c/fastcgi.c
@@ -632,8 +632,7 @@ void uw_do_expunge(uw_context ctx, uw_Basis_client cli, void *data) {
if (uw_get_app(ctx)->db_begin(ctx))
uw_error(ctx, FATAL, "Error running SQL BEGIN");
uw_get_app(ctx)->expunger(ctx, cli);
- if (uw_get_app(ctx)->db_commit(ctx))
- uw_error(ctx, FATAL, "Error running SQL COMMIT");
+ uw_commit(ctx);
}
void uw_post_expunge(uw_context ctx, void *data) {
diff --git a/src/c/http.c b/src/c/http.c
index df9d3080..5fd8080e 100644
--- a/src/c/http.c
+++ b/src/c/http.c
@@ -354,8 +354,7 @@ void uw_do_expunge(uw_context ctx, uw_Basis_client cli, void *data) {
if (uw_get_app(ctx)->db_begin(ctx))
uw_error(ctx, FATAL, "Error running SQL BEGIN");
uw_get_app(ctx)->expunger(ctx, cli);
- if (uw_get_app(ctx)->db_commit(ctx))
- uw_error(ctx, FATAL, "Error running SQL COMMIT");
+ uw_commit(ctx);
}
void uw_post_expunge(uw_context ctx, void *data) {
diff --git a/src/c/urweb.c b/src/c/urweb.c
index 1a193c53..915a8c76 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -159,7 +159,7 @@ typedef struct client {
static client **clients, *clients_free, *clients_used;
static unsigned n_clients;
-static pthread_mutex_t clients_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t clients_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
size_t uw_messages_max = SIZE_MAX;
size_t uw_clients_max = SIZE_MAX;
@@ -177,9 +177,10 @@ static client *new_client() {
c = clients_free;
clients_free = clients_free->next;
}
- else if (n_clients >= uw_clients_max)
+ else if (n_clients >= uw_clients_max) {
+ pthread_mutex_unlock(&clients_mutex);
return NULL;
- else {
+ } else {
++n_clients;
clients = realloc(clients, sizeof(client) * n_clients);
c = malloc(sizeof(client));