=act #15991 send out ack and update pendingWrite in one atomic operation

Otherwise, the user-level actor may already have sent the next chunk before
the pendingWrite has been updated and the TcpConnection will reject it.

Needs backporting to master.

Is there a way to test this?