We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
conn.send_failed
stream.send_all
1 parent be52390 commit df0fc1cCopy full SHA for df0fc1c
examples/trio-server.py
@@ -131,7 +131,13 @@ async def send(self, event):
131
# appropriate when 'data' is None.
132
assert type(event) is not h11.ConnectionClosed
133
data = self.conn.send(event)
134
- await self.stream.send_all(data)
+ try:
135
+ await self.stream.send_all(data)
136
+ except BaseException:
137
+ # If send_all raises an exception (especially trio.Cancelled),
138
+ # we have no choice but to give it up.
139
+ self.conn.send_failed()
140
+ raise
141
142
async def _read_from_peer(self):
143
if self.conn.they_are_waiting_for_100_continue:
0 commit comments