ithinkihaveacat / node-fishback

A caching HTTP proxy written in Node
MIT License
32 stars 6 forks source link

Support "drain" event #2

Open ithinkihaveacat opened 13 years ago

ithinkihaveacat commented 13 years ago

If the proxy reads from the origin faster than we can write to the client, node has to buffer data. It would be better if we stopped reading from the origin under these circumstances. This can be accomplished by checking the return value of the stream.write() call--if false, then data needs to be buffered; in this case we need to stop reading from the origin until the drain event is received.