Skip to content

Commit 5c7217e

Browse files
authored
Apply suggestion from @frostming
1 parent bec6a12 commit 5c7217e

1 file changed

Lines changed: 0 additions & 10 deletions

File tree

‎src/acp/_transport.py‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,6 @@ async def receive(self) -> dict[str, Any] | None:
8484
logging.exception("Error parsing JSON-RPC message")
8585
continue
8686
if not isinstance(message, dict):
87-
# A line can parse as JSON and still not be a JSON-RPC message: a batch
88-
# array, a bare number or string, or ``null``. Returning it is fatal one
89-
# frame later -- ``Connection._process_message`` calls ``message.get(...)``
90-
# and the AttributeError escapes ``_receive_loop``, so ``_disconnect()``
91-
# never runs and the process dies. ``null`` is worse than fatal-by-accident:
92-
# it parses to ``None``, which this method uses as its EOF signal, so it is
93-
# read as "the peer hung up". Malformed JSON is already tolerated above, and
94-
# the web transports already refuse non-object frames (``ws/server.py``
95-
# returns only dicts; ``http/server.py`` answers 501/400), so ignore these
96-
# here too rather than tearing down a live connection.
9787
logging.warning("Ignoring non-object JSON-RPC message")
9888
continue
9989
return message

0 commit comments

Comments
 (0)