diff options
-rw-r--r-- | source3/libsmb/namequery.c | 18 |
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; } |