mirror of
https://codeberg.org/icewind/streams.git
synced 2026-06-03 08:34:09 +02:00
cleanup context handling for wrappers
This commit is contained in:
parent
3171a535de
commit
2c8ae56d02
16 changed files with 182 additions and 258 deletions
|
|
@ -11,25 +11,8 @@ namespace Icewind\Streams;
|
|||
* Wrapper that retries reads/writes to remote streams that dont deliver/recieve all requested data at once
|
||||
*/
|
||||
class RetryWrapper extends Wrapper {
|
||||
|
||||
/**
|
||||
* Wraps a stream with the provided callbacks
|
||||
*
|
||||
* @param resource $source
|
||||
* @return resource
|
||||
*/
|
||||
public static function wrap($source) {
|
||||
$context = stream_context_create(array(
|
||||
'retry' => array(
|
||||
'source' => $source
|
||||
)
|
||||
));
|
||||
return self::wrapSource($source, $context);
|
||||
}
|
||||
|
||||
protected function open() {
|
||||
$this->loadContext('retry');
|
||||
return true;
|
||||
return self::wrapSource($source);
|
||||
}
|
||||
|
||||
public function dir_opendir($path, $options) {
|
||||
|
|
@ -37,7 +20,8 @@ class RetryWrapper extends Wrapper {
|
|||
}
|
||||
|
||||
public function stream_open($path, $mode, $options, &$opened_path) {
|
||||
return $this->open();
|
||||
$this->loadContext();
|
||||
return true;
|
||||
}
|
||||
|
||||
public function stream_read($count) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue