diff options
author | Adam Chlipala <adam@chlipala.net> | 2014-11-16 13:39:18 -0500 |
---|---|---|
committer | Adam Chlipala <adam@chlipala.net> | 2014-11-16 13:39:18 -0500 |
commit | 3978f63f15851ce203d4722008c85b983e50fe6f (patch) | |
tree | c7199464ea21621f3a504c88a6725e69d3ed2aee /src | |
parent | 745a1e34ec9067a8c807971b01d65c350f8e5286 (diff) |
uw_remoteSock()
Diffstat (limited to 'src')
-rw-r--r-- | src/c/http.c | 2 | ||||
-rw-r--r-- | src/c/urweb.c | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/c/http.c b/src/c/http.c index 9651a216..e6c7b1af 100644 --- a/src/c/http.c +++ b/src/c/http.c @@ -89,6 +89,8 @@ static void *worker(void *data) { sock = uw_dequeue(); } + uw_set_remoteSock(ctx, sock); + qprintf("Handling connection with thread #%d.\n", me); while (1) { diff --git a/src/c/urweb.c b/src/c/urweb.c index 09514afa..1f2c8b3c 100644 --- a/src/c/urweb.c +++ b/src/c/urweb.c @@ -476,6 +476,8 @@ struct uw_context { char *output_buffer; size_t output_buffer_size; + + int remoteSock; }; size_t uw_headers_max = SIZE_MAX; @@ -559,6 +561,8 @@ uw_context uw_init(int id, uw_loggers *lg) { ctx->output_buffer = malloc(1); ctx->output_buffer_size = 1; + ctx->remoteSock = -1; + return ctx; } @@ -646,6 +650,7 @@ void uw_reset_keep_error_message(uw_context ctx) { ctx->amInitializing = 0; ctx->usedSig = 0; ctx->needsResig = 0; + ctx->remoteSock = -1; } void uw_reset_keep_request(uw_context ctx) { @@ -4458,3 +4463,11 @@ uw_Basis_string uw_Basis_blessData(uw_context ctx, uw_Basis_string s) { return s; } + +int uw_remoteSock(uw_context ctx) { + return ctx->remoteSock; +} + +void uw_set_remoteSock(uw_context ctx, int sock) { + ctx->remoteSock = sock; +} |