From 0879571897c0c0485890119768a4dad860ee88b0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 3 Sep 2010 19:52:59 +0200 Subject: s4:lib/messaging: implement irpc_bh_set_timeout metze --- source4/lib/messaging/messaging.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'source4/lib/messaging/messaging.c') diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index e50e50f1e2..ae3f908060 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -1004,6 +1004,7 @@ struct irpc_bh_state { struct messaging_context *msg_ctx; struct server_id server_id; const struct ndr_interface_table *table; + uint32_t timeout; }; static bool irpc_bh_is_connected(struct dcerpc_binding_handle *h) @@ -1018,6 +1019,18 @@ static bool irpc_bh_is_connected(struct dcerpc_binding_handle *h) return true; } +static uint32_t irpc_bh_set_timeout(struct dcerpc_binding_handle *h, + uint32_t timeout) +{ + struct irpc_bh_state *hs = dcerpc_binding_handle_data(h, + struct irpc_bh_state); + uint32_t old = hs->timeout; + + hs->timeout = timeout; + + return old; +} + struct irpc_bh_raw_call_state { struct irpc_request *irpc; uint32_t opnum; @@ -1119,7 +1132,10 @@ static struct tevent_req *irpc_bh_raw_call_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - tevent_req_set_endtime(req, ev, timeval_current_ofs(IRPC_CALL_TIMEOUT, 0)); + ok = tevent_req_set_endtime(req, ev, timeval_current_ofs(hs->timeout, 0)); + if (!ok) { + return tevent_req_post(req, ev); + } return req; } @@ -1228,6 +1244,7 @@ static bool irpc_bh_ref_alloc(struct dcerpc_binding_handle *h) static const struct dcerpc_binding_handle_ops irpc_bh_ops = { .name = "wbint", .is_connected = irpc_bh_is_connected, + .set_timeout = irpc_bh_set_timeout, .raw_call_send = irpc_bh_raw_call_send, .raw_call_recv = irpc_bh_raw_call_recv, .disconnect_send = irpc_bh_disconnect_send, @@ -1258,6 +1275,7 @@ struct dcerpc_binding_handle *irpc_binding_handle(TALLOC_CTX *mem_ctx, hs->msg_ctx = msg_ctx; hs->server_id = server_id; hs->table = table; + hs->timeout = IRPC_CALL_TIMEOUT; dcerpc_binding_handle_set_sync_ev(h, msg_ctx->event.ev); -- cgit