summaryrefslogtreecommitdiffhomepage
path: root/src/go/unit/nxt_go_lib.c
diff options
context:
space:
mode:
authorMax Romanov <max.romanov@nginx.com>2018-07-12 15:50:43 +0300
committerMax Romanov <max.romanov@nginx.com>2018-07-12 15:50:43 +0300
commite6cd1c4257945063473d12a1eeed8d07dfe05467 (patch)
tree11b2dfa2322ccfe01a72041ecb0b2ab917d59865 /src/go/unit/nxt_go_lib.c
parent96a4f9f032de2ee385ba84bb3c31b437e9814686 (diff)
downloadunit-e6cd1c4257945063473d12a1eeed8d07dfe05467.tar.gz
unit-e6cd1c4257945063473d12a1eeed8d07dfe05467.tar.bz2
Go: http.Flusher implemented by unit.response.
This closes #133 issue on GitHub.
Diffstat (limited to 'src/go/unit/nxt_go_lib.c')
-rw-r--r--src/go/unit/nxt_go_lib.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/go/unit/nxt_go_lib.c b/src/go/unit/nxt_go_lib.c
index 4455e783..eeb7aa50 100644
--- a/src/go/unit/nxt_go_lib.c
+++ b/src/go/unit/nxt_go_lib.c
@@ -31,6 +31,23 @@ nxt_go_response_write(nxt_go_request_t r, uintptr_t buf, size_t len)
}
+void
+nxt_go_response_flush(nxt_go_request_t r)
+{
+ nxt_go_run_ctx_t *ctx;
+
+ if (nxt_slow_path(r == 0)) {
+ return;
+ }
+
+ ctx = (nxt_go_run_ctx_t *) r;
+
+ if (ctx->nwbuf > 0) {
+ nxt_go_ctx_flush(ctx, 0);
+ }
+}
+
+
int
nxt_go_request_read(nxt_go_request_t r, uintptr_t dst, size_t dst_len)
{