On Sun, 2 Apr 2017 12:08:37 +0200, Sönke Ludwig wrote:
By spec this is be safe to do and at least all places in vibe.d itself
will callflush
properly (including theStreamOutputRange
proxy)..finalize()
should also callflush()
internally.
OK thanks, so I'll implement this optimization. If finalize
is supposed to call flush
internally, finalize
can't be called on an closed stream (i.e. if the other side closed the connection). Am I supposed to check if the connection is closed in finalize
or is this the users responsibility? Also is it valid to free certain C handles in finalize
?
Another unrelated problem, maybe someone has got a good idea: The upcoming noisesocket protocol will likely allow packets up to
2^16-1
bytes. A packet can only be decrypted at once so the complete packet needs top be cached. This leads to huge buffers which is especially annoying when using many streams in parallel. So has anyone already thought about or implemented some kind of buffer sharing between streams / Fibers in vibe.d?I don't know of an existing implementation in this area. The closest
thing would probably be theConnectionPool
, which uses simple
reference counting and aLocalTaskSemaphore
to implement a limited
cross-task resource sharing mechanism.
Hmm OK. Looks like we'll get buffer size negotiation in the noise socket protocol so this might be less important problem than I initially thought.