librpc/rpc/pipe_handle.c
authorStefan Metzmacher <metze@samba.org>
Sat, 21 Sep 2013 07:48:59 +0000 (09:48 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 4 Jun 2019 11:14:55 +0000 (13:14 +0200)
librpc/rpc/pipe_handle.c

index 2bf67ae8e6c0a3b979c45366e60fc8fecd68090c..80d4563ada6ef139056e365fad0eba8f3801b6c0 100644 (file)
@@ -94,6 +94,10 @@ void dcerpc_pipe_handle_connection_disconnect(
        }
 
        if (pc->p != NULL) {
+               if (pc->p->current_req != NULL) {
+                       tevent_req_nterror(pc->p->current_req,
+                                         NT_STATUS_RPC_PIPE_CLOSED);
+               }
                pc->p->pc = NULL;
        }
 
@@ -103,11 +107,6 @@ void dcerpc_pipe_handle_connection_disconnect(
 static int dcerpc_pipe_handle_destructor(struct dcerpc_pipe_handle *p)
 {
        dcerpc_pipe_handle_connection_disconnect(p->pc);
-
-       if (p->current_req) {
-               tevent_req_received(p->current_req);
-       }
-
        return 0;
 }
 
@@ -201,6 +200,8 @@ struct tevent_req *dcerpc_pipe_handle_push_send(TALLOC_CTX *mem_ctx,
        state->ops = p->ops;
        state->p = p;
 
+       tevent_req_defer_callback(req, ev);
+
        talloc_set_destructor(state, dcerpc_pipe_handle_push_state_destructor);
        p->current_req = req;
 
@@ -292,6 +293,8 @@ struct tevent_req *dcerpc_pipe_handle_pull_send(TALLOC_CTX *mem_ctx,
        state->ops = p->ops;
        state->p = p;
 
+       tevent_req_defer_callback(req, ev);
+
        talloc_set_destructor(state, dcerpc_pipe_handle_pull_state_destructor);
        p->current_req = req;