Skip to content
This repository was archived by the owner on Jan 13, 2021. It is now read-only.

Commit 27b862b

Browse files
committed
Handle shutdown.
1 parent 07a7475 commit 27b862b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

hyper/http20/connection.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,13 @@ def receive_frame(self, frame):
223223
f = SettingsFrame(0)
224224
f.flags.add('ACK')
225225
self._send_cb(f)
226+
elif isinstance(frame, GoAwayFrame):
227+
# If we get GoAway with error code zero, we are doing a graceful
228+
# shutdown and all is well. Otherwise, throw an exception.
229+
self.close()
230+
231+
if frame.error_code != 0:
232+
raise RuntimeError("Encountered error %d.", frame.error_code)
226233
else:
227234
raise ValueError("Unexpected frame %s." % frame)
228235

0 commit comments

Comments
 (0)