diff --git a/reference/event/eventhttpconnection/setclosecallback.xml b/reference/event/eventhttpconnection/setclosecallback.xml index 93039c11fc..f653bd9dbf 100644 --- a/reference/event/eventhttpconnection/setclosecallback.xml +++ b/reference/event/eventhttpconnection/setclosecallback.xml @@ -128,12 +128,16 @@ function _http_default($req, $dummy) 58:php 15057 ruslan 7u IPv4 125189 0t0 TCP *:4242 (LISTEN) 59:php 15057 ruslan 8u IPv4 124342 0t0 TCP localhost:4242->localhost:37375 (CLOSE_WAIT) - where $PID is our process ID. + where $PID is our process ID. The following block of code fixes such kind of orphaned connections. */ $bev = $req->getBufferEvent(); $bev->enable(Event::READ); + // We have to free it explicitly. See ]]> + EventHttpRequest::getConnection +free(); // we have to free it explicitly $req->addHeader( 'Content-Type', diff --git a/reference/event/eventhttprequest/getbufferevent.xml b/reference/event/eventhttprequest/getbufferevent.xml index 39500fce9a..d8127595be 100644 --- a/reference/event/eventhttprequest/getbufferevent.xml +++ b/reference/event/eventhttprequest/getbufferevent.xml @@ -18,6 +18,16 @@ EventBufferEvent object which represents buffer event that the connection is using. + + + The reference counter of the returned object will be incremented by one to + protect internal structures against premature destruction when the method + is called from a user callback. So the + EventBufferEvent object should be freed explicitly + with EventBufferEvent::free method. + Otherwise memory will leak. + + &reftitle.parameters;