API Index — Namespaces, Packages, Reports, Indices
FcgiBlockingTransport
in package
implements
FcgiTransport
Blocking FastCGI transport (#289) — plain stream_socket_client + blocking
fread/fwrite.
Used when the dispatch runs OUTSIDE a coroutine (Coroutine::getCid() < 0) —
the legacy-cgi / superglobals(true) lifecycles, where the OpenSwoole worker
handles one request at a time synchronously and the request handler is NOT
coroutine-wrapped. A blocking socket has no coroutine scheduler to deadlock,
which is the correct behaviour there: it replaces #261's nested
Coroutine::run() that hung every request (#289).
Outside a coroutine, OpenSwoole's runtime hooks are inactive, so these
fread/fwrite calls are ordinary blocking syscalls — no event loop involved.
The socket timeout (stream_set_timeout) bounds a wedged backend so a stuck
php-fpm can't pin the worker forever.
Table of Contents
Interfaces
- FcgiTransport
- Socket transport for {@see FastCgiClient} (#289).
Properties
Methods
- __construct() : mixed
- close() : void
- Close the connection (idempotent).
- connect() : void
- Open the connection to the FastCGI backend.
- recv() : string
- Receive up to
$maxLenbytes. Returns''on a clean EOF (peer closed). - send() : void
- Send all bytes to the backend.
Properties
$host
private
string
$host
$isUnix
private
bool
$isUnix
$port
private
int
$port
$sock
private
resource|null
$sock
= null
$timeout
private
float
$timeout
Methods
__construct()
public
__construct(string $host, int $port, bool $isUnix, float $timeout) : mixed
Parameters
- $host : string
- $port : int
- $isUnix : bool
- $timeout : float
close()
Close the connection (idempotent).
public
close() : void
connect()
Open the connection to the FastCGI backend.
public
connect() : void
recv()
Receive up to $maxLen bytes. Returns '' on a clean EOF (peer closed).
public
recv(int $maxLen) : string
Parameters
- $maxLen : int
Return values
stringsend()
Send all bytes to the backend.
public
send(string $data) : void
Parameters
- $data : string