reactphp-legacy/socket-client

Support Promise cancellation

clue opened this issue · 4 comments

clue commented

We should register a Promise cancellation handler so that the following code actually cleans up the underlying socket resource:

$promise = $connector->create('reactphp.org', 80);

$promise->cancel();

This can eventually also be used as the basis for timeout support (#28), similar to this:

$promise = $connector->create('reactphp.org', 80);
$loop->addTimer(3.0, function () use ($promise) {
    $promise->cancel();
});
clue commented

This also likely depends on reactphp/dns#28 so that the DNS request can also be canceled.

clue commented

This also likely depends on reactphp/dns#28 so that the DNS request can also be canceled.

Available as of v0.4.3.

I'm now looking into this...

Any help needed on this ? :) I need this to properly timeout requests in the http-client

clue commented

Will be resolved via #71 🎉