From e5d7cfa894ddb7d30f5b63ef272f33e80e1c63f3 Mon Sep 17 00:00:00 2001 From: Ruslan Osmanov Date: Thu, 20 Nov 2014 09:57:42 +0000 Subject: [PATCH] [pecl][event] synced with version event-1.11.2 git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@335200 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../event/eventhttpconnection/setclosecallback.xml | 6 +++++- reference/event/eventhttprequest/getbufferevent.xml | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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;