Closes #14421: use with statement to properly close socket in bandwidth test.
This commit is contained in:
parent
1641bb7669
commit
c0fdf6cf7a
|
@ -435,7 +435,7 @@ def run_bandwidth_client(**kwargs):
|
|||
def run_bandwidth_test(func, args, nthreads):
|
||||
# Create a listening socket to receive the packets. We use UDP which should
|
||||
# be painlessly cross-platform.
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
|
||||
sock.bind(("127.0.0.1", 0))
|
||||
addr = sock.getsockname()
|
||||
|
||||
|
|
Loading…
Reference in New Issue