mirror of
https://github.com/samba-team/samba.git
synced 2025-01-25 06:04:04 +03:00
selftest: Make dns_hub socket timeout match DNS_REQUEST_TIMEOUT
I was hitting the recv_packet = s.recv(2048, 0) exception because the socket timeout was reached. We've seen it before, but it seemed more common after changing the default process-model to prefork. This patch makes the socket timeout used by the python code consistent with the C code. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
2e8daeb2bb
commit
55cce81587
@ -34,6 +34,8 @@ else:
|
|||||||
import socketserver
|
import socketserver
|
||||||
sserver = socketserver
|
sserver = socketserver
|
||||||
|
|
||||||
|
DNS_REQUEST_TIMEOUT = 10
|
||||||
|
|
||||||
|
|
||||||
class DnsHandler(sserver.BaseRequestHandler):
|
class DnsHandler(sserver.BaseRequestHandler):
|
||||||
def dns_transaction_udp(self, packet, host):
|
def dns_transaction_udp(self, packet, host):
|
||||||
@ -42,7 +44,7 @@ class DnsHandler(sserver.BaseRequestHandler):
|
|||||||
try:
|
try:
|
||||||
send_packet = ndr.ndr_pack(packet)
|
send_packet = ndr.ndr_pack(packet)
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, 0)
|
||||||
s.settimeout(5)
|
s.settimeout(DNS_REQUEST_TIMEOUT)
|
||||||
s.connect((host, 53))
|
s.connect((host, 53))
|
||||||
s.sendall(send_packet, 0)
|
s.sendall(send_packet, 0)
|
||||||
recv_packet = s.recv(2048, 0)
|
recv_packet = s.recv(2048, 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user