Skip to content

Commit 598c0fc

Browse files
author
xingyuan
committed
fix stream bug when use ssl
1 parent c330b84 commit 598c0fc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

kubernetes/base/stream/ws_client.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ def update(self, timeout=0):
182182
# efficient as epoll. Will work for fd numbers above 1024.
183183
# select.epoll() - newest and most efficient way of polling.
184184
# However, only works on linux.
185+
ssl_pending = 0
186+
if self.sock.is_ssl():
187+
ssl_pending = self.sock.sock.pending()
188+
185189
if hasattr(select, "poll"):
186190
poll = select.poll()
187191
poll.register(self.sock.sock, select.POLLIN)
@@ -193,7 +197,7 @@ def update(self, timeout=0):
193197
r, _, _ = select.select(
194198
(self.sock.sock, ), (), (), timeout)
195199

196-
if r:
200+
if r or ssl_pending > 0:
197201
op_code, frame = self.sock.recv_data_frame(True)
198202
if op_code == ABNF.OPCODE_CLOSE:
199203
self._connected = False

0 commit comments

Comments
 (0)