Make unix work again
This commit is contained in:
parent
3b0175c135
commit
e5d9ef954d
20
ol-unix.c
20
ol-unix.c
@ -261,7 +261,7 @@ void ol__read(ol_handle* handle) {
|
|||||||
} else {
|
} else {
|
||||||
ol_err err = ol_err_new(handle, errno);
|
ol_err err = ol_err_new(handle, errno);
|
||||||
if (cb) {
|
if (cb) {
|
||||||
cb(req, 0, err);
|
cb(req, 0);
|
||||||
}
|
}
|
||||||
ol_close_error(handle, errno);
|
ol_close_error(handle, errno);
|
||||||
}
|
}
|
||||||
@ -280,7 +280,7 @@ void ol__read(ol_handle* handle) {
|
|||||||
|
|
||||||
/* NOTE: call callback AFTER freeing the request data. */
|
/* NOTE: call callback AFTER freeing the request data. */
|
||||||
if (cb) {
|
if (cb) {
|
||||||
cb(req, nread, 0);
|
cb(req, nread);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ol_read_reqs_empty(handle)) {
|
if (ol_read_reqs_empty(handle)) {
|
||||||
@ -366,7 +366,8 @@ ol_req* ol_req_maybe_alloc(ol_handle* handle, ol_req* in_req) {
|
|||||||
in_req->_.local = 0;
|
in_req->_.local = 0;
|
||||||
return in_req;
|
return in_req;
|
||||||
} else {
|
} else {
|
||||||
ol_req *req = calloc(sizeof(ol_req), 1);
|
ol_req *req = malloc(sizeof(ol_req));
|
||||||
|
ol_req_init(req, NULL);
|
||||||
req->handle = handle;
|
req->handle = handle;
|
||||||
ngx_queue_init(&(req->_.read_reqs));
|
ngx_queue_init(&(req->_.read_reqs));
|
||||||
req->_.local = 1;
|
req->_.local = 1;
|
||||||
@ -431,7 +432,7 @@ int ol_write(ol_handle* handle, ol_req *req, ol_buf* bufs, int bufcnt) {
|
|||||||
} else {
|
} else {
|
||||||
if (req && req->cb) {
|
if (req && req->cb) {
|
||||||
ol_write_cb cb = req->cb;
|
ol_write_cb cb = req->cb;
|
||||||
cb(req, 0);
|
cb(req);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -464,7 +465,7 @@ int ol_read(ol_handle* handle, ol_req *req_in, ol_buf* bufs, int bufcnt) {
|
|||||||
ol_err err = ol_err_new(handle, errno);
|
ol_err err = ol_err_new(handle, errno);
|
||||||
|
|
||||||
if (cb) {
|
if (cb) {
|
||||||
cb(req_in, nread, err);
|
cb(req_in, nread);
|
||||||
}
|
}
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@ -473,7 +474,7 @@ int ol_read(ol_handle* handle, ol_req *req_in, ol_buf* bufs, int bufcnt) {
|
|||||||
if (nread >= 0) {
|
if (nread >= 0) {
|
||||||
/* Successful read. */
|
/* Successful read. */
|
||||||
if (cb) {
|
if (cb) {
|
||||||
cb(req_in, nread, 0);
|
cb(req_in, nread);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -517,3 +518,10 @@ void ol_free(ol_handle* handle) {
|
|||||||
/* lists? */
|
/* lists? */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void ol_req_init(ol_req *req, void *cb) {
|
||||||
|
req->type = OL_UNKNOWN_REQ;
|
||||||
|
req->cb = cb;
|
||||||
|
ngx_queue_init(&(req->_.read_reqs));
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user