summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-06-02 10:54:49 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2012-06-02 10:54:49 -0400
commitb3dec3df4038cf76821f43717673456c7f691030 (patch)
tree3bcfe01a624da73f52ff82ceb31de49d776b4092
parent0ea6bd1ccba2c945b12199d2b12a9ed3bb565e06 (diff)
Avoid redundant rollbacks
-rw-r--r--src/c/request.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/c/request.c b/src/c/request.c
index 9f8cab36..a697ba44 100644
--- a/src/c/request.c
+++ b/src/c/request.c
@@ -503,6 +503,8 @@ request_result uw_request(uw_request_context rc, uw_context ctx,
uw_write(ctx, uw_error_message(ctx));
uw_write(ctx, "\n</body></html>");
+ try_rollback(ctx, 0, logger_data, log_error);
+
return FAILED;
}
} else
@@ -515,8 +517,6 @@ request_result uw_request(uw_request_context rc, uw_context ctx,
else {
log_error(logger_data, "Fatal error (out of retries): %s\n", uw_error_message(ctx));
- try_rollback(ctx, 0, logger_data, log_error);
-
if (!had_error && uw_get_app(ctx)->on_error) {
had_error = 1;
strcpy(errmsg, uw_error_message(ctx));
@@ -528,6 +528,8 @@ request_result uw_request(uw_request_context rc, uw_context ctx,
uw_write(ctx, uw_error_message(ctx));
uw_write(ctx, "\n");
+ try_rollback(ctx, 0, logger_data, log_error);
+
return FAILED;
}
}
@@ -536,8 +538,6 @@ request_result uw_request(uw_request_context rc, uw_context ctx,
else if (fk == FATAL) {
log_error(logger_data, "Fatal error: %s\n", uw_error_message(ctx));
- try_rollback(ctx, 0, logger_data, log_error);
-
if (uw_get_app(ctx)->on_error && !had_error) {
had_error = 1;
strcpy(errmsg, uw_error_message(ctx));
@@ -550,13 +550,13 @@ request_result uw_request(uw_request_context rc, uw_context ctx,
uw_write(ctx, uw_error_message(ctx));
uw_write(ctx, "\n</body></html>");
+ try_rollback(ctx, 0, logger_data, log_error);
+
return FAILED;
}
} else {
log_error(logger_data, "Unknown uw_handle return code!\n");
- try_rollback(ctx, 0, logger_data, log_error);
-
if (uw_get_app(ctx)->on_error && !had_error) {
had_error = 1;
strcpy(errmsg, "Unknown uw_handle return code");
@@ -566,6 +566,8 @@ request_result uw_request(uw_request_context rc, uw_context ctx,
uw_write_header(ctx, "Content-type: text/plain\r\n");
uw_write(ctx, "Unknown uw_handle return code!\n");
+ try_rollback(ctx, 0, logger_data, log_error);
+
return FAILED;
}
}