diff options
author | Max Romanov <max.romanov@nginx.com> | 2017-08-11 18:04:04 +0300 |
---|---|---|
committer | Max Romanov <max.romanov@nginx.com> | 2017-08-11 18:04:04 +0300 |
commit | 39a6a4c973dd378f1fad9d2514d7857fe491df4b (patch) | |
tree | 220ea8605a9396a93fa7a459ff3e558fe1a044aa /src/nginext/request.go | |
parent | e1e808bd94609c80b4990939285d47f124bb2eef (diff) | |
download | unit-39a6a4c973dd378f1fad9d2514d7857fe491df4b.tar.gz unit-39a6a4c973dd378f1fad9d2514d7857fe491df4b.tar.bz2 |
Request body read state implemented.
With specific timeout and buffer size settings.
Diffstat (limited to 'src/nginext/request.go')
-rw-r--r-- | src/nginext/request.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/nginext/request.go b/src/nginext/request.go index 8667a074..1679f1c7 100644 --- a/src/nginext/request.go +++ b/src/nginext/request.go @@ -21,7 +21,6 @@ type request struct { resp *response c_req C.nxt_go_request_t id C.uint32_t - read_pos C.off_t msgs []*cmsg ch chan *cmsg } @@ -29,18 +28,17 @@ type request struct { func (r *request) Read(p []byte) (n int, err error) { c := C.size_t(cap(p)) b := C.malloc(c) - res := C.nxt_go_request_read(r.c_req, r.read_pos, b, c) + res := C.nxt_go_request_read(r.c_req, b, c) if res == -2 /* NXT_AGAIN */ { m := <-r.ch - res = C.nxt_go_request_read_from(r.c_req, r.read_pos, b, c, m.buf.b, m.buf.s) + res = C.nxt_go_request_read_from(r.c_req, b, c, m.buf.b, m.buf.s) r.push(m) } if res > 0 { copy(p, C.GoBytes(b, res)) - r.read_pos += C.off_t(res) } C.free(b) |