vibe-d / vibe.d

Official vibe.d development
MIT License
1.15k stars 284 forks source link

Acquiring writer of already owned connection #1888

Open deviator opened 7 years ago

deviator commented 7 years ago

While using vibe-mqtt I get this assertion error from here.

It happens if I send many data through mqtt, and I think it's because tcp socket in some moment does not have time to send data. Increasing send data time interval only defer this error.

How I can workaround this?

s-ludwig commented 7 years ago

There needs to be a TaskMutex or some other means for task synchronization around the write operations to guarantee that they are sequential. I'm planning to support read/write queuing for later versions of vibe-core/eventcore, but currently this unfortunately makes things a bit less efficient (although maybe synchronization will still be needed if vibe-mqtt doesn't send each packet atomically).