mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-20 00:20:47 +00:00
The current implementation uses a sort of "manual reference counting"; any place which may be the last one using the connection checks if it is indeed the last one, and if so, deletes the connection object. With recent changes this has become unwields, as there are too many cases to track. To fix, we separate the connection into two streams: a read() stream that is internally serialized (only one request is parsed at a time) and that returns when there are no more requests to parse, and a respond() stream that is also internally serialized, and termiantes when the last response has been written. The caller then waits on the two streams with when_all().