PHP Class Amp\Artax\SocketPool

Afficher le fichier Open project: amphp/artax

Méthodes publiques

Méthode Description
checkin ( resource $resource ) : self Return a previously checked-out socket to the pool
checkout ( string $uri, array $options = [] ) : Amp\Promise Checkout a socket from the specified URI authority
clear ( resource $resource ) : self Remove the specified socket from the pool
setOption ( integer $option, mixed $value ) : self Set socket pool options

Private Methods

Méthode Description
allowsNewConnection ( $uri, $options )
checkoutExistingSocket ( $uri, $options )
checkoutNewSocket ( $uri, $options )
dequeueNextWaitingSocket ( $uri )
finalizeNewConnection ( Amp\Deferred $promisor, $uri, $socket, $options )
finalizeSocketCheckin ( $uri, $socketId )
initializeIdleTimeout ( Amp\Artax\SocketPoolStruct $poolStruct )
initializeNewConnection ( Amp\Deferred $promisor, $uri, $options )
isSocketDead ( $resource )
unloadSocket ( $uri, $socketId )

Method Details

checkin() public méthode

Return a previously checked-out socket to the pool
public checkin ( resource $resource ) : self
$resource resource
Résultat self

checkout() public méthode

The resulting socket resource should be checked back in via SocketPool::checkin() once the calling code is finished with the stream (even if the socket has been closed). Failure to checkin sockets will result in memory leaks and socket queue blockage.
public checkout ( string $uri, array $options = [] ) : Amp\Promise
$uri string A string of the form somedomain.com:80 or 192.168.1.1:443
$options array
Résultat Amp\Promise Returns a promise that resolves to a socket once a connection is available

clear() public méthode

Remove the specified socket from the pool
public clear ( resource $resource ) : self
$resource resource
Résultat self

setOption() public méthode

Set socket pool options
public setOption ( integer $option, mixed $value ) : self
$option integer
$value mixed
Résultat self