diff options
author | 2009-03-29 11:37:29 -0400 | |
---|---|---|
committer | 2009-03-29 11:37:29 -0400 | |
commit | 843fcc973f4cf7b149d4f57732fb66f812115320 (patch) | |
tree | bae33dd5ebd8393e6dd1b30f7d1a2b75241c9956 /src/c/driver.c | |
parent | 9f3c3a0215d3f23c8e51fa4824d21dfeaa08ede0 (diff) |
Redo channels, making them single-client
Diffstat (limited to 'src/c/driver.c')
-rw-r--r-- | src/c/driver.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/c/driver.c b/src/c/driver.c index 4fa5db2f..1b616636 100644 --- a/src/c/driver.c +++ b/src/c/driver.c @@ -171,10 +171,10 @@ static void *worker(void *data) { char *pass = uw_Basis_requestHeader(ctx, "UrWeb-Pass"); if (id && pass) { - size_t idn = atoi(id); + unsigned idn = atoi(id); uw_client_connect(idn, atoi(pass), sock); dont_close = 1; - fprintf(stderr, "Processed request for messages by client %d\n\n", (int)idn); + fprintf(stderr, "Processed request for messages by client %u\n\n", idn); } break; } @@ -217,6 +217,8 @@ static void *worker(void *data) { else { printf("Fatal error (out of retries): %s\n", uw_error_message(ctx)); + try_rollback(ctx); + uw_reset_keep_error_message(ctx); uw_write_header(ctx, "HTTP/1.1 500 Internal Server Error\n\r"); uw_write_header(ctx, "Content-type: text/plain\r\n"); @@ -224,8 +226,6 @@ static void *worker(void *data) { uw_write(ctx, uw_error_message(ctx)); uw_write(ctx, "\n"); - try_rollback(ctx); - break; } } else if (fk == UNLIMITED_RETRY) @@ -233,6 +233,8 @@ static void *worker(void *data) { else if (fk == FATAL) { printf("Fatal error: %s\n", uw_error_message(ctx)); + try_rollback(ctx); + uw_reset_keep_error_message(ctx); uw_write_header(ctx, "HTTP/1.1 500 Internal Server Error\r\n"); uw_write_header(ctx, "Content-type: text/html\r\n"); @@ -241,26 +243,24 @@ static void *worker(void *data) { uw_write(ctx, uw_error_message(ctx)); uw_write(ctx, "\n</body></html>"); - try_rollback(ctx); - break; } else { printf("Unknown uw_handle return code!\n"); + try_rollback(ctx); + uw_reset_keep_request(ctx); uw_write_header(ctx, "HTTP/1.1 500 Internal Server Error\n\r"); uw_write_header(ctx, "Content-type: text/plain\r\n"); uw_write(ctx, "Unknown uw_handle return code!\n"); - try_rollback(ctx); - break; } - uw_reset_keep_request(ctx); - if (try_rollback(ctx)) break; + + uw_reset_keep_request(ctx); } uw_send(ctx, sock); |