await stream._add_input(event.data, event.end_stream)
elif isinstance(event, aioquic.quic.events.HandshakeCompleted):
self._handshake_complete.set()
- elif isinstance(
- event, aioquic.quic.events.ConnectionTerminated
- ) or isinstance(event, aioquic.quic.events.StreamReset):
+ elif isinstance(event, aioquic.quic.events.ConnectionTerminated):
self._done = True
self._receiver_task.cancel()
+ elif isinstance(event, aioquic.quic.events.StreamReset):
+ stream = self._streams.get(event.stream_id)
+ if stream:
+ await stream._add_input(b"", True)
+
count += 1
if count > 10:
# yield
def _common_add_input(self, data, is_end):
self._buffer.put(data, is_end)
- return self._expecting > 0 and self._buffer.have(self._expecting)
+ try:
+ return self._expecting > 0 and self._buffer.have(self._expecting)
+ except UnexpectedEOF:
+ return True
def _close(self):
self._connection.close_stream(self._stream_id)
stream._add_input(event.data, event.end_stream)
elif isinstance(event, aioquic.quic.events.HandshakeCompleted):
self._handshake_complete.set()
- elif isinstance(
- event, aioquic.quic.events.ConnectionTerminated
- ) or isinstance(event, aioquic.quic.events.StreamReset):
+ elif isinstance(event, aioquic.quic.events.ConnectionTerminated):
with self._lock:
self._done = True
+ elif isinstance(event, aioquic.quic.events.StreamReset):
+ with self._lock:
+ stream = self._streams.get(event.stream_id)
+ if stream:
+ stream._add_input(b"", True)
def write(self, stream, data, is_end=False):
with self._lock:
await stream._add_input(event.data, event.end_stream)
elif isinstance(event, aioquic.quic.events.HandshakeCompleted):
self._handshake_complete.set()
- elif isinstance(
- event, aioquic.quic.events.ConnectionTerminated
- ) or isinstance(event, aioquic.quic.events.StreamReset):
+ elif isinstance(event, aioquic.quic.events.ConnectionTerminated):
self._done = True
self._socket.close()
+ elif isinstance(event, aioquic.quic.events.StreamReset):
+ stream = self._streams.get(event.stream_id)
+ if stream:
+ await stream._add_input(b"", True)
count += 1
if count > 10:
# yield