Home » Networking » Net_Server » Bug #2157
socket_shutdown and onShutdown callback
Details
| Request #2157 | socket_shutdown and onShutdown callback |
|---|---|
| Submitted | 2004-08-18 13:27 UTC |
| From | ivan at oxylus dot si |
| Assigned | schst |
| Status | Closed |
| Package | Net_Server |
| PHP Version | 5.0.0 |
| OS | Linux |
| Roadmaps | (Not assigned) |
Comments
[2004-08-18 13:27 UTC] ivan at oxylus dot si
Description:
------------
'Fork' driver does not call onShutdown() callback function. Also, socket_shutdown() is not called prior to socket_close() which prevents client from receiving EOF on the socket stream. This, for instance, blocks the fgets() or fread() call on the client.
I propose that we modify the closeConnection() function of the Net/Server/Driver/Fork.php so that it calls socket_shutdown() and also callback onShutdown() prior to exit.
I copy/pasted the function code snippet into "Reproduce code".
Reproduce code:
---------------
function closeConnection()
{
if (!isset($this->clientFD[0])) {
return $this->raiseError( "Connection already has been closed." );
}
if (method_exists($this->callbackObj, "onClose")) {
$this->callbackObj->onClose($id);
}
$this->_sendDebugMessage("Closed connection from ".$this->clientInfo[0]["host"]." on port ".$this->clie$
@socket_shutdown($this->clientFD[0], 2);
@socket_close($this->clientFD[0]);
$this->clientFD[0] = null;
unset($this->clientInfo[0]);
if (method_exists($this->callbackObj, "onShutdown")) {
$this->callbackObj->onShutdown($id);
}
exit;
}