From: Stefano Rivera <stefano@rivera.za.net>
Date: Tue, 10 May 2022 15:02:38 -0400
Subject: Support waitress 2

waitress.compat was cleaned up as the code was made Python >= 3 only.
reraise was an indirect import from waitress.compat.

Provide Channel.check_client_disconnected

Required by waitress 2, to detect that a client has disconnected.

Forwarded: https://github.com/gawel/aiowsgi/pull/8
---
 aiowsgi/__init__.py | 3 +++
 aiowsgi/task.py     | 3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/aiowsgi/__init__.py b/aiowsgi/__init__.py
index 5deee33..21c6be6 100644
--- a/aiowsgi/__init__.py
+++ b/aiowsgi/__init__.py
@@ -68,6 +68,9 @@ class Channel(object):
             return len(data)
         return 0
 
+    def check_client_disconnected(self):
+        return self.transport.is_closing()
+
 
 def create_server(application, ssl=None, **adj):
     """Create a wsgi server:
diff --git a/aiowsgi/task.py b/aiowsgi/task.py
index f40c901..f272df7 100644
--- a/aiowsgi/task.py
+++ b/aiowsgi/task.py
@@ -1,5 +1,4 @@
 from .compat import asyncio
-from waitress.task import reraise
 from waitress.task import hop_by_hop
 from waitress.task import ErrorTask  # NOQA
 from waitress.task import WSGITask as Task
@@ -26,7 +25,7 @@ class WSGITask(Task):
                         # 1. "service" method in task.py
                         # 2. "service" method in channel.py
                         # 3. "handler_thread" method in task.py
-                        reraise(exc_info[0], exc_info[1], exc_info[2])
+                        raise exc_info[1]
                     else:
                         # As per WSGI spec existing headers must be cleared
                         self.response_headers = []
