server: fix ._writeData bug

Sink should not be decreased until data is split in chunks