diff options
author | Stefan Metzmacher <metze@samba.org> | 2007-04-23 12:31:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 14:51:32 -0500 |
commit | f66bd1ae54c2d69b84790f4a2a860d4a3c65873e (patch) | |
tree | 3d5caad1872cc93d999197136021e41347664248 | |
parent | d7b01752491b0cd4389d1f29f1a17c1ab4394357 (diff) | |
download | samba-f66bd1ae54c2d69b84790f4a2a860d4a3c65873e.tar.gz samba-f66bd1ae54c2d69b84790f4a2a860d4a3c65873e.tar.bz2 samba-f66bd1ae54c2d69b84790f4a2a860d4a3c65873e.zip |
r22486: add a flag to ignore timeouts of a request and don't close
the connection on timeout
metze
(This used to be commit 6b23ab1fd265e2a92456701fb02bd1838c098874)
-rw-r--r-- | source4/librpc/rpc/dcerpc.c | 12 | ||||
-rw-r--r-- | source4/librpc/rpc/dcerpc.h | 1 | ||||
-rw-r--r-- | source4/torture/rpc/echo.c | 9 |
3 files changed, 20 insertions, 2 deletions
diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 79e897313d..e422fa5444 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -673,6 +673,17 @@ static void dcerpc_timeout_handler(struct event_context *ev, struct timed_event struct timeval t, void *private) { struct rpc_request *req = talloc_get_type(private, struct rpc_request); + + if (req->ignore_timeout) { + dcerpc_req_dequeue(req); + req->state = RPC_REQUEST_DONE; + req->status = NT_STATUS_IO_TIMEOUT; + if (req->async.callback) { + req->async.callback(req); + } + return; + } + dcerpc_connection_dead(req->p->conn, NT_STATUS_IO_TIMEOUT); } @@ -945,6 +956,7 @@ static struct rpc_request *dcerpc_request_send(struct dcerpc_pipe *p, req->flags = 0; req->fault_code = 0; req->async_call = async; + req->ignore_timeout = False; req->async.callback = NULL; req->async.private = NULL; req->recv_handler = NULL; diff --git a/source4/librpc/rpc/dcerpc.h b/source4/librpc/rpc/dcerpc.h index c6dbc35477..ea6c68b28e 100644 --- a/source4/librpc/rpc/dcerpc.h +++ b/source4/librpc/rpc/dcerpc.h @@ -246,6 +246,7 @@ struct rpc_request { uint16_t opnum; DATA_BLOB request_data; BOOL async_call; + BOOL ignore_timeout; /* use by the ndr level async recv call */ struct { diff --git a/source4/torture/rpc/echo.c b/source4/torture/rpc/echo.c index f2a40912e6..21f8eed00d 100644 --- a/source4/torture/rpc/echo.c +++ b/source4/torture/rpc/echo.c @@ -388,8 +388,12 @@ static bool test_timeout(struct torture_context *tctx, r.in.seconds = 2; p->request_timeout = 1; - torture_assert(tctx, req = dcerpc_echo_TestSleep_send(p, tctx, &r), - "Failed to send async sleep request"); + req = dcerpc_echo_TestSleep_send(p, tctx, &r); + if (!req) { + torture_comment(tctx, "Failed to send async sleep request\n"); + goto failed; + } + req->ignore_timeout = True; status = dcerpc_ndr_request_recv(req); torture_assert_ntstatus_equal(tctx, status, NT_STATUS_IO_TIMEOUT, @@ -408,6 +412,7 @@ static bool test_timeout(struct torture_context *tctx, torture_comment(tctx, "Failed to send async sleep request\n"); goto failed; } + req->ignore_timeout = True; status = dcerpc_ndr_request_recv(req); torture_assert_ntstatus_equal(tctx, status, NT_STATUS_IO_TIMEOUT, "request should have timed out"); |