Mercurial > urweb
changeset 2073:1839df6ed755
uw_remoteSock()
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sun, 16 Nov 2014 13:39:18 -0500 |
parents | d77b0665ba7c |
children | e48e09a1f583 |
files | include/urweb/urweb_cpp.h src/c/http.c src/c/urweb.c |
diffstat | 3 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/include/urweb/urweb_cpp.h Sat Sep 20 13:55:25 2014 -0400 +++ b/include/urweb/urweb_cpp.h Sun Nov 16 13:39:18 2014 -0500 @@ -393,4 +393,7 @@ extern const char uw_begin_xhtml[], uw_begin_html5[]; +int uw_remoteSock(struct uw_context *); +void uw_set_remoteSock(struct uw_context *, int sock); + #endif
--- a/src/c/http.c Sat Sep 20 13:55:25 2014 -0400 +++ b/src/c/http.c Sun Nov 16 13:39:18 2014 -0500 @@ -89,6 +89,8 @@ sock = uw_dequeue(); } + uw_set_remoteSock(ctx, sock); + qprintf("Handling connection with thread #%d.\n", me); while (1) {
--- a/src/c/urweb.c Sat Sep 20 13:55:25 2014 -0400 +++ b/src/c/urweb.c Sun Nov 16 13:39:18 2014 -0500 @@ -476,6 +476,8 @@ char *output_buffer; size_t output_buffer_size; + + int remoteSock; }; size_t uw_headers_max = SIZE_MAX; @@ -559,6 +561,8 @@ ctx->output_buffer = malloc(1); ctx->output_buffer_size = 1; + ctx->remoteSock = -1; + return ctx; } @@ -646,6 +650,7 @@ ctx->amInitializing = 0; ctx->usedSig = 0; ctx->needsResig = 0; + ctx->remoteSock = -1; } void uw_reset_keep_request(uw_context ctx) { @@ -4458,3 +4463,11 @@ return s; } + +int uw_remoteSock(uw_context ctx) { + return ctx->remoteSock; +} + +void uw_set_remoteSock(uw_context ctx, int sock) { + ctx->remoteSock = sock; +}