Skip to content

Commit 52e6e1d

Browse files
allrob23cgoldberg
andauthored
[py] improve socket resource management with proper shutdown sequence (#15453)
fix: add socket.shutdown() before close() to ensure timely closing Co-authored-by: Corey Goldberg <[email protected]>
1 parent ced5b22 commit 52e6e1d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

py/selenium/webdriver/common/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ def is_connectable(port: int, host: Optional[str] = "localhost") -> bool:
104104
result = False
105105
finally:
106106
if socket_:
107+
try:
108+
socket_.shutdown(socket.SHUT_RDWR)
109+
except:
110+
pass
107111
socket_.close()
108112
return result
109113

0 commit comments

Comments
 (0)