-
-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Mock server tests (in _test_session.pony, _test_cancel.pony, _test_auth.pony, _test_copy_in.pony, etc.) use _received_count — counting _on_received calls — to determine which protocol phase the server is in. But _on_received fires per TCP segment, not per protocol message. If TCP splits a small message across two segments, the count gets out of sync and the server responds incorrectly.
Observed: CopyIn/Abort failed intermittently with "Expected ErrorResponseMessage but got ClientQueryError" — the mock server likely processed a split segment as a phase transition, causing the client session to shut down.
The fix would be to buffer all data and track protocol state by parsing message boundaries (type byte + length) instead of counting _on_received calls. This affects all mock server tests that use the _received_count pattern.