mirror of
https://github.com/samba-team/samba.git
synced 2025-01-21 18:04:06 +03:00
ldb: allow a timeout of -1 result in no timeout timer at all.
This is required in order to have long running async searches, e.g. with LDB_CONTROL_NOTIFICATION_OID. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
5db9f865bc
commit
2b1cd4a114
@ -252,8 +252,11 @@ static int lldb_search(struct lldb_context *lldb_ac)
|
||||
break;
|
||||
}
|
||||
|
||||
tv.tv_sec = req->timeout;
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
if (req->timeout > 0) {
|
||||
tv.tv_sec = req->timeout;
|
||||
}
|
||||
|
||||
ret = ldap_search_ext(lldb->ldap, search_base, ldap_scope,
|
||||
expression,
|
||||
@ -836,13 +839,14 @@ static int lldb_handle_request(struct ldb_module *module, struct ldb_request *re
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
|
||||
|
||||
if (req->timeout > 0) {
|
||||
tv.tv_sec = req->starttime + req->timeout;
|
||||
tv.tv_usec = 0;
|
||||
te = tevent_add_timer(ev, ac, tv, lldb_timeout, ac);
|
||||
if (NULL == te) {
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return LDB_SUCCESS;
|
||||
}
|
||||
|
@ -1566,11 +1566,14 @@ static int lsql_handle_request(struct ldb_module *module, struct ldb_request *re
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
|
||||
if (req->timeout > 0) {
|
||||
tv.tv_sec = req->starttime + req->timeout;
|
||||
tv.tv_usec = 0;
|
||||
ac->timeout_event = tevent_add_timer(ev, ac, tv, lsql_timeout, ac);
|
||||
if (NULL == ac->timeout_event) {
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
return LDB_SUCCESS;
|
||||
}
|
||||
|
@ -1469,12 +1469,16 @@ static int ltdb_handle_request(struct ldb_module *module,
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
|
||||
if (req->timeout > 0) {
|
||||
tv.tv_sec = req->starttime + req->timeout;
|
||||
ac->timeout_event = tevent_add_timer(ev, ac, tv, ltdb_timeout, ac);
|
||||
tv.tv_usec = 0;
|
||||
ac->timeout_event = tevent_add_timer(ev, ac, tv,
|
||||
ltdb_timeout, ac);
|
||||
if (NULL == ac->timeout_event) {
|
||||
talloc_free(ac);
|
||||
return LDB_ERR_OPERATIONS_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
/* set a spy so that we do not try to use the request context
|
||||
* if it is freed before ltdb_callback fires */
|
||||
|
Loading…
x
Reference in New Issue
Block a user