Hi,

I am learning libuv in attempt to evaluate it's suitability for my project. 
Besides reading it's code I tried to rewrite echo server example using 
coroutines (libcoro) with one twist -- I want to limit memory usage on 
per-connection basis and (if client writes to socket faster than it reads 
from it) -- maintain stable transfer speed.

This means:
- ring buffer (lets say 1kb per connection)
- reading data from socket directly into a ring buffer (in read callback)
- writing using uv_try_write if there is data in the ring buffer and socket 
is writeable

Unfortunately I can't find a way to be notified of socket becoming 
writeable -- is it possible with libuv? If not -- why?

I hope it is not too confusing what I am trying to do -- I need to be able 
to mark portions of my ring buffer as "free" as data is being written out. 
Currently if I schedule a 1MB write -- my write_cb won't get called until 
all data is written out. Which may take a very long time -- and all this 
time entire 1Mb of my ring buffer will be unavailable for read_cb to read 
data into potentially causing client to block. Then, after write is 
complete -- entire 1Mb will become available, unblocking client and causing 
transfer speed to zig-zag...

Regards,
Michael.

-- 
You received this message because you are subscribed to the Google Groups 
"libuv" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/libuv.
For more options, visit https://groups.google.com/d/optout.

Reply via email to