Fixed issue with sockets potentially left open during gather pings

This commit is contained in:
Eric Froemling 2020-10-30 09:43:47 -05:00
parent 688a18eca0
commit 126d40e9a5
3 changed files with 20 additions and 12 deletions

View File

@ -3936,20 +3936,20 @@
"build/prefab/full/linux_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/1f/35/484a59829aa95cb574d92fd92e0a",
"build/prefab/full/linux_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/1f/25/4f6745b63934978593c7fa1b0bbe",
"build/prefab/full/linux_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/7e/fb/a5c8df06a54e1a09f5666b8ff5c9",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/87/a8/4b010d314db66abe5b25802a9750",
"build/prefab/full/mac_x86_64/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/45/b4/064ae72bd5dea448df9032ff898d",
"build/prefab/full/mac_x86_64/release/ballisticacore": "https://files.ballistica.net/cache/ba1/c2/4f/db74db99ed3e5e113045f052cf88",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/3d/0e/3ee777df8921481b470469ceff81",
"build/prefab/full/mac_x86_64_server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/0f/60/55edba8a7866f6a46fb566f12758",
"build/prefab/full/mac_x86_64_server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/8a/cf/9b9f51de2b77c9fe045656364a68",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/8c/56/2b57d75357f031f2af75a0660563",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/40/f6/3c1fede3bbd69881c294e1385e49",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/1b/11/fb2bc55368412d2777ced295370e",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/d9/54/b21e77d2ec1b985c973c6d3d6670",
"build/prefab/full/windows_x86/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/44/e2/cc0ae0a00cdd4f4619d9febf3c95",
"build/prefab/full/windows_x86/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/36/53/152b18c6132f99b667bf9cdc01b3",
"build/prefab/full/windows_x86_server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/93/37/79d9fcfcc3ab2f83ea0000a8f1d7",
"build/prefab/full/windows_x86_server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/8e/8d/116311b8a458a71043b89cd67491",
"build/prefab/lib/linux_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c3/d7/627d518a92951cf7fe9fc0b9b3a0",
"build/prefab/lib/linux_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/de/49/2cfc34ac856737d903954db5571b",
"build/prefab/lib/linux_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e8/9a/67cf9ece361ca2f5d338009bdbfc",
"build/prefab/lib/linux_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/86/de/7d9c9a2b7bba34c630130ed759c9",
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/bb/3b/5e76b260ae0f7ba853d30c01a4e3",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/3d/3d/a44a8daaada0fcf3723b454b06c6",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/f2/17/67a8258b2d4c2d071d3eb182cda5",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/1c/16/4b758a685852096860c7b4acbb7e"
"build/prefab/lib/mac_x86_64/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/6f/66/a11145a8609f6f518256a831b7fd",
"build/prefab/lib/mac_x86_64/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/e2/89/48d9153dffbb67075672d2ba9577",
"build/prefab/lib/mac_x86_64_server/debug/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/c5/1c/1b727d9c8872db41e434c2eed4ee",
"build/prefab/lib/mac_x86_64_server/release/libballisticacore_internal.a": "https://files.ballistica.net/cache/ba1/01/c0/3c78ee23711a90d53c1771944dcb"
}

View File

@ -1,4 +1,4 @@
### 1.5.27 (20231)
### 1.5.27 (20234)
- Language functionality has been consolidated into a LanguageSubsystem object at ba.app.lang
- ba.get_valid_languages() is now an attr: ba.app.lang.available_languages
- Achievement functionality has been consolidated into an AchievementSubsystem object at ba.app.ach

View File

@ -112,7 +112,9 @@ class PingThread(threading.Thread):
def run(self) -> None:
# pylint: disable=too-many-branches
# pylint: disable=too-many-statements
ba.app.ping_thread_count += 1
sock: Optional[socket.socket] = None
try:
import socket
from ba.internal import get_ip_address_type
@ -139,7 +141,6 @@ class PingThread(threading.Thread):
accessible = True
break
time.sleep(1)
sock.close()
ping = int((time.time() - starttime) * 1000.0)
ba.pushcall(ba.Call(self._call, self._address, self._port,
ping if accessible else None),
@ -177,6 +178,13 @@ class PingThread(threading.Thread):
f'(errno={exc.errno})', once=True)
except Exception:
ba.print_exception('Error on gather ping', once=True)
finally:
try:
if sock is not None:
sock.close()
except Exception:
ba.print_exception('Error on gather ping cleanup', once=True)
ba.app.ping_thread_count -= 1