akka/akka — pull request #16317 by ktoso (2014-11-17 15:16:20+00:00)
Title: =str #16315 fixes assumption that substream key is always present

Since keys may be removed because of timeouts or cancels etc it is not safe to `apply` on `substreamOutputs`.
This PR is a rather defensive one and perhaps keeping apply would still be in the case of `SubstreamSubscribe`, thinking about cases still..

Also, I believe there was a slight race, though when I walked through it I found it's the harmless kind of race, so perhaps not worh guarding against - but since spent some time on thinking about it including it as 2nd commit here so we (similar to what @patriknw pointed out in my recent https://github.com/akka/akka/pull/16291#discussion_r20345277) which I have described here in detail in the 2nd commit. Perhaps it does not really matter - since the cancelling subscriber will just be onErrored and not able to cancel the stream hm. // Still wrapping my head around this if it's a problem or not.