Niklas Keller
c75af3778b
Fix ResourceOutputStream closed detection ( #60 )
...
The previous mechanism with feof doesn't work for systemd launched processes.
Fixes #58 .
2019-06-03 23:45:17 +02:00
Gabriel Ostrolucký
d5cd42a765
Add chunksize setter to Resource*Stream classes ( #55 )
...
Fixes #50 .
2019-03-31 16:51:36 +02:00
Niklas Keller
2120bdd46b
Revert "Throw new exception carrying $chunk when fwrite returns 0"
...
This reverts commit eb4d03504d
.
The previous commit was incomplete and needs additional work.
2019-03-11 20:12:45 +01:00
Gabriel Ostrolucký
eb4d03504d
Throw new exception carrying $chunk when fwrite returns 0
2019-03-05 00:11:39 +01:00
Niklas Keller
37b9ab16bb
Solve performance issues with very large chunks
...
Very large chunks need to be copied every time there's a partial write, which is pretty problematic. Instead of doing an almost full copy of the full chunk every time, this patch splits very large chunks into multiple smaller chunks automatically.
Fixes #41 .
2018-10-22 14:37:37 -05:00
Niklas Keller
d161589772
Apply PSR-2
2018-09-22 16:04:00 +02:00
Aaron Piotrowski
24b2530ec7
Remove exception overwrite
...
Copy/paste oversight.
2018-04-05 09:44:39 -05:00
Aaron Piotrowski
da357d1579
Proper fix for remote closed streams
...
Fixes #40 . Streams on MacOS (and possibly FreeBSD) that are closed by the remote still allow writing, returning a non-zero from fwrite(). EOF then is false, since data was written to the buffer. EOF needed to be checked before calling fwrite().
2018-04-03 19:08:18 -05:00
Aaron Piotrowski
33a74dfecd
Fix closed streams that continually report as writable
2018-04-03 11:57:25 -05:00
Niklas Keller
56e814943a
Add tests for dead socket detection
...
Relates to #40 .
2018-04-03 18:20:40 +02:00
Aaron Piotrowski
11da27c603
Only throw if resource closed or at eof
2018-02-09 00:47:09 -06:00
Niklas Keller
2cb8005742
Throw correct exception in ResourceOutputStream after close
...
Fixes #35 .
2018-02-07 13:49:07 +01:00
Niklas Keller
0c059ba0e6
Suppress errors also for stream_socket_shutdown, relates to #32
2017-12-10 17:40:58 +01:00
Aaron Piotrowski
fdcf400f19
Check writable flag rather than for null resource
...
Also null resource when writing in watcher callback fails. Fixes #20 .
2017-09-15 00:17:42 -05:00
Bob Weinand
666ece18a4
Fix invalid StreamException upon full write buffer
...
And add a few tests with chunk size writes
2017-07-15 10:06:12 +02:00
Niklas Keller
b67358ad91
Suppress errors on close for resource streams
...
A resource might still be non-null, but already closed.
2017-06-19 08:43:07 +02:00
Aaron Piotrowski
48c4e122d8
Tweak closing
...
Resource is not nulled in watcher callback if reading/writing fails so close() will still call shutdown/fclose.
2017-06-18 23:14:59 -05:00
Niklas Keller
798723e942
Use \fclose for unidirectional resources to cover pipes
2017-06-18 22:57:19 +02:00
Niklas Keller
93540890fd
Remove unnecessary isset check for stream modes
2017-06-18 22:55:44 +02:00
Niklas Keller
161c73471d
stream_socket_shutdown resources in ROS on close
2017-06-18 20:16:05 +02:00
Aaron Piotrowski
816307c665
Fix writing in watcher callback if $chunkSize is null
2017-06-18 11:47:58 -05:00
Niklas Keller
ea135f26d0
Fix chunk size issue in ResourceOutputStream, fixes #14
2017-05-29 17:34:29 +02:00
Niklas Keller
2ecbf8aa8b
Respect chunk size for ResourceOutputStream, document resource streams
2017-05-25 18:12:12 +02:00
Niklas Keller
eb9394a5da
Make resource streams final
2017-05-22 14:38:39 +02:00
Niklas Keller
9e90d1fa09
Add tests, fix ResourceOutputStream writable check
2017-05-16 23:27:48 +02:00
Aaron Piotrowski
ca3ab2dc73
Restore destructor on resource stream
...
Forgot close() needed to be called to free watcher.
2017-05-12 10:27:58 -05:00
Aaron Piotrowski
c2eac67b79
Fix close() and make public again
2017-05-11 23:52:15 -05:00
Aaron Piotrowski
cfbf25e3b5
Remove close() from interfaces
2017-05-11 18:08:45 -05:00
Niklas Keller
3a51a03d0f
Fix code style
2017-05-07 22:19:55 +02:00
Niklas Keller
73e6441fd9
Add getResource() to resource streams
2017-05-05 16:45:53 +02:00
Niklas Keller
622f98c966
Improve readability, written is never larger than length
2017-05-05 15:42:18 +02:00
Niklas Keller
bf90335bb6
Major API change + merged Reader and Writer from amphp/socket
2017-04-30 08:33:16 +02:00