joyent/libuv — pull request #753 by bnoordhuis (2013-03-26 14:46:41+00:00)
Title: unix, windows: don't read/recv if buf.len==0

Make it possible for the libuv user to handle out of memory conditions
gracefully. When alloc_cb() returns a buffer with len==0, call the read
or recv callback with nread=-1 and error=UV_ENOBUFS. It's up to the
user to close the handle.

Fixes #752.

Suggested reviewer: @piscisaureus

I tried to exercise due diligence when going over the Windows code but it's completely untested. View it as a starting point for you to improve on. :-)