basho/riak_cs — pull request #932 by kuenishi (2014-07-30 04:36:26+00:00)
Title: Bugfix/kill copy on disconnect

Copying can't be stopped on client disconnect, because it does not need any socket read/writes once copying started. That makes detecting client disconnect harder - this patch puts a zero-timeout read on socket to find `{error, closed}` and other errors. This is a dirty hack and mochiweb or webmachine should have such interface that handles lower layer connection error handling, but for now we adopt this hack, which should be fixed in the future.
Copy should be cancelled because orphan copy without clients are likely not required by clients and may cause overloaded cluster.

Important limitation is: if client sends any additional HTTP request to CS during copy being processed, Riak CS reads that request and throws error, and cancels the copy.