stream: improving error handling
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
documentation is changed or added -
commit message follows commit guidelines
Affected core subsystem(s)
stream
This PR improves error handling for streams in a few ways.
- It ensures that no user defined methods (_read, _write, ...) are run after .destroy has been called.
- It introduces an explicit error to tell the user if they are write to write, etc to the stream after it has been destroyed.
- It makes streams always emit
close
as the last thing after they have been destroyed - Changes the default _destroy to not gracefully end streams.
Especially 4. makes it easier for userland modules to handle stream errors as they don't appear as graceful closes anymore. Seen issues being with end-of-stream/pump because of this.