Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e93f240

Browse filesBrowse files
authored
Merge pull request #2316 from anvil-works/handle-ws-close
Close the Python sockets when the Websocket closes
2 parents 0219799 + 3b58df2 commit e93f240
Copy full SHA for e93f240

File tree

1 file changed

+7
-2
lines changed
Filter options

1 file changed

+7
-2
lines changed

‎kubernetes/base/stream/ws_client.py

Copy file name to clipboardExpand all lines: kubernetes/base/stream/ws_client.py
+7-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from six.moves.urllib.parse import urlencode, urlparse, urlunparse
3131
from six import StringIO, BytesIO
3232

33-
from websocket import WebSocket, ABNF, enableTrace
33+
from websocket import WebSocket, ABNF, enableTrace, WebSocketConnectionClosedException
3434
from base64 import urlsafe_b64decode
3535
from requests.utils import should_bypass_proxies
3636

@@ -379,7 +379,12 @@ def _proxy(self):
379379
if sock == self.websocket:
380380
pending = True
381381
while pending:
382-
opcode, frame = self.websocket.recv_data_frame(True)
382+
try:
383+
opcode, frame = self.websocket.recv_data_frame(True)
384+
except WebSocketConnectionClosedException:
385+
for port in self.local_ports.values():
386+
port.python.close()
387+
return
383388
if opcode == ABNF.OPCODE_BINARY:
384389
if not frame.data:
385390
raise RuntimeError("Unexpected frame data size")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.