summaryrefslogtreecommitdiff
path: root/source3/libsmb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-04-25 17:37:08 +0200
committerVolker Lendecke <vlendec@samba.org>2011-04-25 18:39:20 +0200
commita3d35ac44b53b8a79eac5c927ff771c1c6ceec12 (patch)
treec269eb6ce68a95daf5a20f2974ec4bf4f6444149 /source3/libsmb
parent7269e455a7d4f659777b4ab7db5d8b68376c8d19 (diff)
downloadsamba-a3d35ac44b53b8a79eac5c927ff771c1c6ceec12.tar.gz
samba-a3d35ac44b53b8a79eac5c927ff771c1c6ceec12.tar.bz2
samba-a3d35ac44b53b8a79eac5c927ff771c1c6ceec12.zip
s3: Move setting the name_query timeout
An async caller might want a different timeout behaviour
Diffstat (limited to 'source3/libsmb')
-rw-r--r--source3/libsmb/namequery.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index ef7aab6a6a..9489878ce4 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -1177,7 +1177,6 @@ struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
struct packet_struct p;
struct nmb_packet *nmb = &p.packet.nmb;
struct sockaddr_in *in_addr;
- struct timeval timeout;
req = tevent_req_create(mem_ctx, &state, struct name_query_state);
if (req == NULL) {
@@ -1243,14 +1242,6 @@ struct tevent_req *name_query_send(TALLOC_CTX *mem_ctx,
DEBUG(10, ("nb_trans_send failed\n"));
return tevent_req_post(req, ev);
}
- if (bcast) {
- timeout = timeval_current_ofs(0, 250000);
- } else {
- timeout = timeval_current_ofs(2, 0);
- }
- if (!tevent_req_set_endtime(req, ev, timeout)) {
- return tevent_req_post(req, ev);
- }
tevent_req_set_callback(subreq, name_query_done, req);
return req;
}
@@ -1433,6 +1424,7 @@ NTSTATUS name_query(const char *name, int name_type,
TALLOC_CTX *frame = talloc_stackframe();
struct tevent_context *ev;
struct tevent_req *req;
+ struct timeval timeout;
NTSTATUS status = NT_STATUS_NO_MEMORY;
ev = tevent_context_init(frame);
@@ -1443,6 +1435,14 @@ NTSTATUS name_query(const char *name, int name_type,
if (req == NULL) {
goto fail;
}
+ if (bcast) {
+ timeout = timeval_current_ofs(0, 250000);
+ } else {
+ timeout = timeval_current_ofs(2, 0);
+ }
+ if (!tevent_req_set_endtime(req, ev, timeout)) {
+ goto fail;
+ }
if (!tevent_req_poll_ntstatus(req, ev, &status)) {
goto fail;
}