1
0
mirror of https://github.com/danog/byte-stream.git synced 2024-12-02 09:17:50 +01:00
Commit Graph

238 Commits

Author SHA1 Message Date
Niklas Keller
a4cf31f089 Add buffer test 2018-09-22 16:04:00 +02:00
Niklas Keller
75aa20de7c Add buffer function
This simplifies buffering streams by not having to construct a Message / Payload object.
2018-09-22 16:04:00 +02:00
Niklas Keller
bd2de267cc Update shared documentation files
This is an automated commit. Please report any issues to https://github.com/amphp/website-tools.
2018-05-16 16:15:55 +02:00
Aaron Piotrowski
24b2530ec7
Remove exception overwrite
Copy/paste oversight.
2018-04-05 09:44:39 -05:00
Niklas Keller
1b75b122e6 Fix ZlibInputStreamTest::testRead() for Windows 2018-04-04 07:33:09 +02: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
Niklas Keller
5403767515 Use xdebug instead of phpdbg for coverage
PHPDBG segfaults currently.
2018-04-03 22:15:31 +02:00
Niklas Keller
1184827fd8 Revert "Update test"
This reverts commit 5ba0469d7a.

The test should verify that the socket is detected as closed even if the
work is still alive and has an open FD.
2018-04-03 22:12:42 +02:00
Aaron Piotrowski
5ba0469d7a
Update test 2018-04-03 12:23:39 -05:00
Aaron Piotrowski
33a74dfecd
Fix closed streams that continually report as writable 2018-04-03 11:57:25 -05:00
Niklas Keller
43a93e6240 Add closed stream test with leaked FDs 2018-04-03 18:30:21 +02:00
Niklas Keller
56e814943a Add tests for dead socket detection
Relates to #40.
2018-04-03 18:20:40 +02:00
Aaron Piotrowski
6d6c89f58c
Update docs nav 2018-03-13 10:32:38 -05:00
Aaron Piotrowski
bfa012e810
Add Payload docs 2018-03-13 10:26:29 -05:00
Aaron Piotrowski
6bd0be750d Add Payload
Similar to Message, but does not implement Promise to avoid all the issues that are associated with that.
2018-03-13 09:53:18 -05:00
Niklas Keller
9f60974881 Fix resource input streams
The read watcher needs to be disabled now, because immediate reads will process the next immediate read now in the next tick.

Fixes #38.
2018-03-11 10:19:43 +01:00
Aaron Piotrowski
ca9128aead
Merge pull request #37 from amphp/fix-immediate
Defer immediate reads
2018-03-09 10:44:35 -06:00
Niklas Keller
062f16d0c5 Defer immediate reads
Immediate reads have been introduced to support in-memory streams and STDIN on Windows, but this causes problems during piping of streams that always have data available, because it blocks everything else. This is resolved by deferring the promise resolution to the next tick.
2018-03-09 17:40:36 +01:00
Niklas Keller
a4739c8a6d Attempt direct read on ResourceInputStream::read()
This change should resolve the low performance on Windows' STDIN. STDIN
on Windows is a file handle and Windows has specialized support built
into it's stream_select implementation, but a stream_select with a file
handle takes 100ms, which results in slow performance if we read in
smaller chunks and always have to wait 100ms between these.

Fixes amphp/socket#52.
2018-03-08 11:38:16 +01:00
Aaron Piotrowski
11da27c603
Only throw if resource closed or at eof 2018-02-09 00:47:09 -06:00
Niklas Keller
561c364128 Upgrade documentation dependencies
This fixes the GitHub security warning.
2018-02-07 13:52:39 +01:00
Niklas Keller
2cb8005742 Throw correct exception in ResourceOutputStream after close
Fixes #35.
2018-02-07 13:49:07 +01:00
Niklas Keller
1b0b8daed4 Polyfill STDOUT and STDERR on SAPIs not being CLI
STDERR is used by amphp/parallel for error forwarding from children. STDERR gets written to the error log in case of Apache and similar locations for other SAPIs.

This also ensures STDOUT / STDERR can always be used and only a single stream ID exists for STDOUT / STDERR, which might otherwise error for libuv if people open 'php://stderr' multiple times.

Fixes amphp/parallel-functions#6.
Fixes amphp/parallel#34.
2018-01-12 20:43:00 +01:00
Niklas Keller
0b6d99b2c3 Remove outdated note about closing ResourceInputStreams 2017-12-27 20:13:24 +01:00
Niklas Keller
5dffe33692 Throw correct PendingReadError for IteratorStream 2017-12-22 09:31:37 +01:00
Niklas Keller
926fa6d24d Update shared documentation files
This is an automated commit. Please report any issues to https://github.com/amphp/website-tools.
2017-12-14 19:16:44 +01:00
Niklas Keller
0c059ba0e6 Suppress errors also for stream_socket_shutdown, relates to #32 2017-12-10 17:40:58 +01:00
Niklas Keller
c5e31aa7b7 Fix #32: Suppress errors for feof, because pthreads 2017-12-10 17:36:05 +01:00
Niklas Keller
cd4ef8553e Update shared documentation files
This is an automated commit. Please report any issues to https://github.com/amphp/website-tools.
2017-12-06 12:50:30 +01:00
Niklas Keller
3c24903849 Use fread() for STDIO instead of stream_get_contents()
Turns out this fixes the issues with amphp/parallel on Windows.
2017-12-05 19:57:30 +01:00
Aaron Piotrowski
a1bd230eca
Define target platform in composer.json and fix .travis.yml 2017-12-02 20:32:00 -06:00
Niklas Keller
e103ca8c52 Update shared documentation files
This is an automated commit. Please report any issues to https://github.com/amphp/website-tools.
2017-10-20 19:13:58 +02:00
Niklas Keller
e6c169a61a Update shared documentation files
This is an automated commit. Please report any issues to https://github.com/amphp/website-tools.
2017-10-20 18:33:43 +02:00
Sébastien Nikolaou
e00c6d4926 Simplify OutputBuffer tests 2017-10-17 21:24:21 +02:00
Sébastien Nikolaou
48bb2ebf78 Extract OutputBuffer class 2017-10-17 21:24:21 +02:00
Sébastien Nikolaou
a4a132c056 Remove error suppressions for deflate_add 2017-10-17 21:24:21 +02:00
Sébastien Nikolaou
8af72be249 Fix code standards 2017-10-17 21:24:21 +02:00
Sébastien Nikolaou
4e0e9a6b66 Increase test coverage 2017-10-17 21:24:21 +02:00
Niklas Keller
f63b98990e Optimize memory consumption of Amp\ByteStream\pipe 2017-10-17 09:22:17 +02:00
Bob Weinand
0f501deb7c Fix #29 - do not release resource on __destruct()
This ensures getResource() still returning a valid resource during cyclic garbage collection
2017-10-17 03:50:40 +02:00
Niklas Keller
d60ba033c4 Use stream_get_contents instead of fread for ResourceInputStream
This fixes an issue with TLS streams: https://github.com/amphp/artax/issues/138.

We still use  for UDP, because stream_get_contents might read multiple packages there if I'm not mistaken.
2017-10-08 12:38:01 +02:00
Niklas Keller
00643414ac Fix editorconfig, add 7.2 to Travis, update shared 2017-10-07 10:32:29 +02:00
Niklas Keller
af613a0a77 Fix Message::read() if stream fails with a pending read 2017-10-07 10:28:45 +02:00
Fabien Villepinte
0dff1fe859 Anonymous function has an unused use $resource 2017-10-01 12:04:51 +02:00
Niklas Keller
f68b424ab4 Update shared documentation files
This is an automated commit. Please report any issues to https://github.com/amphp/website-tools.
2017-09-27 15:07:51 +02:00
Niklas Keller
ef7063f9d1 Provide description and keywords for docs 2017-09-27 14:08:08 +02:00
Niklas Keller
d5a705ea9b Update to new shared docs repo 2017-09-27 13:56:06 +02:00
Niklas Keller
341a035318 Update shared documentation files
This is an automated commit. Please report any issues to https://github.com/amphp/website-tools.
2017-09-21 18:14:37 +02:00
Niklas Keller
f3f5ccabbc Update shared documentation files
This is an automated commit. Please report any issues to https://github.com/amphp/website-tools.
2017-09-20 21:48:46 +02:00
Niklas Keller
f93296ed2d Update shared documentation files
This is an automated commit. Please report any issues to https://github.com/amphp/website-tools.
2017-09-16 19:34:22 +02:00