juliangruber/multilevel — pull request #57 by soldair (2014-08-15 19:13:31+00:00)
Title: propagating close and end events to server

fixes. Leaks all client ended read streams.

readable streams passed from server to client like level-live-stream that never end on the server cannot be ended from multilevel client. the server never gets the end event though thbey are supported by mdm.

the fix is when a tmp-stream is "replaced" with the mdm stream bind end on the tmp stream to trigger end on the mdm stream. for write stream support also close should be bubbled.

this example results in the whole database being streamed to the client's network connection.

```
db.createReadStream().once('data',function(){ this.end(); })
```
the expected behavior is that the server side of the stream gets the end event that mdm passes and stops streaming the whole database.

though the data event doesn't get fired on ended streams the server is still doing the work and sending the data!