Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 375ff58

Browse files
committed
Issue #11179: Make ccbench work under Python 3.1 and 2.7 again.
1 parent 147f608 commit 375ff58

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ Build
8181
- Issue #11268: Prevent Mac OS X Installer failure if Documentation
8282
package had previously been installed.
8383

84+
Tools/Demos
85+
-----------
86+
87+
- Issue #11179: Make ccbench work under Python 3.1 and 2.7 again.
88+
8489
Tests
8590
-----
8691

Tools/ccbench/ccbench.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ def _recv(sock, n):
276276
return sock.recv(n).decode('ascii')
277277

278278
def latency_client(addr, nb_pings, interval):
279-
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as sock:
279+
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
280+
try:
280281
_time = time.time
281282
_sleep = time.sleep
282283
def _ping():
@@ -289,6 +290,8 @@ def _ping():
289290
_sleep(interval)
290291
_ping()
291292
_sendto(sock, LAT_END + "\n", addr)
293+
finally:
294+
sock.close()
292295

293296
def run_latency_client(**kwargs):
294297
cmd_line = [sys.executable, '-E', os.path.abspath(__file__)]

0 commit comments

Comments
 (0)