Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.3

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)    
Subscription  


 [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; }

Comments

 [2004-08-18 20:49 UTC] schst
onShutdown is reserved for stopping the whole server. This will be implemented at a later time.
 [2004-08-18 20:49 UTC] schst
This bug has been fixed in CVS. In case this was a documentation problem, the fix will show up at the end of next Sunday (CET) on pear.php.net. In case this was a pear.php.net website problem, the change will show up on the website in short time. Thank you for the report, and for helping us make PEAR better.