reactphp/react — pull request #179 by clue (2013-04-19 10:09:48+00:00)
Title: Fix trying to call read listeners for streams already removed

I frequently encounter PHP warnings in my SOCKS proxy project if several streams close or change their readable state during the same tick (polling window).

Essentially in my project $stream1 is piped to $stream2 and vice-versa for full duplex operation. If either streams closes, the other stream has to be closed as well. Closing a stream involves calling `removeReadStream()` and thus its event listener will be removed from the event loop. If both streams are _readable_ at the same time, the second stream raises an error due to the missing event listener.

The same logic is already in place for write streams.