asyncpg icon indicating copy to clipboard operation
asyncpg copied to clipboard

TLSUpgradeProto: don't set multiple results for an event

Open w-miller opened this issue 1 year ago • 1 comments

In the case of a misbehaving server, the client may receive more than one byte in separate data_received() invocations from the server. While we can't do much sane with this, we should handle it gracefully and not crash with asyncio.InvalidStateError when trying to set another result on the event.

Fixes #729

w-miller avatar Jan 31 '24 08:01 w-miller

This appears to be a duplicate of https://github.com/MagicStack/asyncpg/pull/1031, though it's a nicer version and comes with tests. Previously @elprans did not like the approach.

eltoder avatar Mar 09 '24 20:03 eltoder