Simplify async programming a bit with helper routines
[abartlet/samba.git/.git] / source3 / libsmb / clifile.c
index a9e81082eafc0f11b123f4f11db7c154f22c6758..733abb6510ce6f2523005440b5c236ba3b51fc83 100644 (file)
@@ -908,9 +908,8 @@ NTSTATUS cli_open_recv(struct async_req *req, int *fnum)
        uint8_t *bytes;
        NTSTATUS status;
 
-       SMB_ASSERT(req->state >= ASYNC_REQ_DONE);
-       if (req->state == ASYNC_REQ_ERROR) {
-               return req->status;
+       if (async_req_is_error(req, &status)) {
+               return status;
        }
 
        status = cli_pull_reply(req, &wct, &vwv, &num_bytes, &bytes);
@@ -985,10 +984,10 @@ NTSTATUS cli_close_recv(struct async_req *req)
        uint16_t *vwv;
        uint16_t num_bytes;
        uint8_t *bytes;
+       NTSTATUS status;
 
-       SMB_ASSERT(req->state >= ASYNC_REQ_DONE);
-       if (req->state == ASYNC_REQ_ERROR) {
-               return req->status;
+       if (async_req_is_error(req, &status)) {
+               return status;
        }
 
        return cli_pull_reply(req, &wct, &vwv, &num_bytes, &bytes);